本文整理汇总了PHP中dol_escape_js函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_escape_js函数的具体用法?PHP dol_escape_js怎么用?PHP dol_escape_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_escape_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
//.........这里部分代码省略.........
$out .= "</td></tr>\n";
}
// Message
if (!empty($this->withbody)) {
$defaultmessage = "";
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) {
$defaultmessage = $arraydefaultmessage['content'];
} elseif (!is_numeric($this->withbody)) {
$defaultmessage = $this->withbody;
}
// Complete substitution array
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) {
require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
$langs->load('paypal');
if ($this->param["models"] == 'order_send') {
$url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
if ($this->param["models"] == 'facture_send') {
$url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
}
$defaultmessage = str_replace('\\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} else {
if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
}
if (isset($_POST["message"]) && !$_POST['modelselected']) {
$defaultmessage = $_POST["message"];
} else {
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
$out .= '<tr>';
$out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>';
$out .= '<td>';
if ($this->withbodyreadonly) {
$out .= nl2br($defaultmessage);
$out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />';
} else {
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if ($this->withfckeditor == -1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$this->withfckeditor = 1;
} else {
$this->withfckeditor = 0;
}
}
$doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72);
$out .= $doleditor->Create(1);
}
$out .= "</td></tr>\n";
}
if ($this->withform == 1 || $this->withform == -1) {
$out .= '<tr><td align="center" colspan="2"><div class="center">';
$out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"';
}
$out .= ' />';
if ($this->withcancel) {
$out .= ' ';
$out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />';
}
$out .= '</div></td></tr>' . "\n";
}
$out .= '</table>' . "\n";
if ($this->withform == 1) {
$out .= '</form>' . "\n";
}
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is calle at every key pressed ! */
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});';
$out .= ' })';
$out .= '</script>';
}
$out .= "<!-- End form mail -->\n";
return $out;
}
}
示例2: dol_escape_js
if ($objsoc->client != 0) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&socid=' . $objsoc->id . '">' . $langs->trans("AddBill") . '</a>';
} else {
print '<a class="butActionRefused" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a>';
}
} else {
print '<a class="butActionRefused" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a>';
}
}
}
// Add action
if ($conf->agenda->enabled && !empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
if ($user->rights->agenda->myactions->create) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&socid=' . $objsoc->id . '">' . $langs->trans("AddAction") . '</a>';
} else {
print '<a class="butAction" title="' . dol_escape_js($langs->trans("NotAllowed")) . '" href="#">' . $langs->trans("AddAction") . '</a>';
}
}
/*if ($user->rights->societe->contact->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$objsoc->id.'&action=create">'.$langs->trans("AddContact").'</a>';
}*/
print '</div>';
print "<br>\n";
if (!empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) {
print '<br>';
// List of contacts
show_contacts($conf, $langs, $db, $objsoc, $_SERVER["PHP_SELF"] . '?socid=' . $objsoc->id);
}
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
// List of todo actions
示例3: draw_jflot
/**
* Build a graph onto disk using JFlot library. Input when calling this method should be:
* $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x
* $this->legend= array("Val1",...,"Valn"); // list of n series name
* $this->type = array('bars',...'lines'); or array('pie')
* $this->mode = 'depth' ???
* $this->bgcolorgrid
* $this->datacolor
*
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk
* @return void
*/
private function draw_jflot($file, $fileurl)
{
global $artichow_defaultfont;
dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type));
if (empty($this->width) && empty($this->height)) {
print 'Error width or height not set';
return;
}
$legends = array();
$nblot = count($this->data[0]) - 1;
// -1 to remove legend
if ($nblot < 0) {
dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw');
}
$firstlot = 0;
// Works with line but not with bars
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
$i = $firstlot;
$serie = array();
while ($i < $nblot) {
$values = array();
// Array with horizontal y values (specific values of a serie) for each abscisse x
$serie[$i] = "var d" . $i . " = [];\n";
// Fill array $values
$x = 0;
foreach ($this->data as $valarray) {
$legends[$x] = $valarray[0];
$values[$x] = is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null;
$x++;
}
// TODO Avoid push by adding generated long array...
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
foreach ($values as $x => $y) {
if (isset($y)) {
$serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n";
}
}
} else {
foreach ($values as $x => $y) {
if (isset($y)) {
$serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n";
}
}
}
unset($values);
$i++;
}
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
$this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
if (!empty($this->title)) {
$this->_stringtoshow .= '<div align="center" class="dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
}
$this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . '"></div>' . "\n";
$this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
$this->_stringtoshow .= '$(function () {' . "\n";
$i = $firstlot;
while ($i < $nblot) {
$this->_stringtoshow .= $serie[$i];
$i++;
}
$this->_stringtoshow .= "\n";
// Special case for Graph of type 'pie'
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
$datacolor = array();
foreach ($this->datacolor as $val) {
$datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]);
}
$urltemp = '';
// TODO Add support for url link into labels
$showlegend = $this->showlegend;
$showpointvalue = $this->showpointvalue;
$showpercent = $this->showpercent;
$this->_stringtoshow .= '
function plotWithOptions_' . $tag . '() {
$.plot($("#placeholder_' . $tag . '"), d0,
{
series: {
pie: {
show: true,
radius: 3/4,
label: {
show: true,
radius: 3/4,
formatter: function(label, series) {
var percent=Math.round(series.percent);
//.........这里部分代码省略.........
示例4: define
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
session_cache_limiter(FALSE);
require_once '../../main.inc.php';
// Define javascript type
header('Content-type: text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=3600, public, must-revalidate');
} else {
header('Cache-Control: no-cache');
}
// Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
$tradMonths = array(dol_escape_js($langs->transnoentitiesnoconv("January")), dol_escape_js($langs->transnoentitiesnoconv("February")), dol_escape_js($langs->transnoentitiesnoconv("March")), dol_escape_js($langs->transnoentitiesnoconv("April")), dol_escape_js($langs->transnoentitiesnoconv("May")), dol_escape_js($langs->transnoentitiesnoconv("June")), dol_escape_js($langs->transnoentitiesnoconv("July")), dol_escape_js($langs->transnoentitiesnoconv("August")), dol_escape_js($langs->transnoentitiesnoconv("September")), dol_escape_js($langs->transnoentitiesnoconv("October")), dol_escape_js($langs->transnoentitiesnoconv("November")), dol_escape_js($langs->transnoentitiesnoconv("December")));
$tradMonthsShort = array($langs->trans("JanuaryMin"), $langs->trans("FebruaryMin"), $langs->trans("MarchMin"), $langs->trans("AprilMin"), $langs->trans("MayMin"), $langs->trans("JuneMin"), $langs->trans("JulyMin"), $langs->trans("AugustMin"), $langs->trans("SeptemberMin"), $langs->trans("OctoberMin"), $langs->trans("NovemberMin"), $langs->trans("DecemberMin"));
$tradDays = array($langs->trans("Sunday"), $langs->trans("Monday"), $langs->trans("Tuesday"), $langs->trans("Wednesday"), $langs->trans("Thursday"), $langs->trans("Friday"), $langs->trans("Saturday"));
$tradDaysShort = array($langs->trans("ShortSunday"), $langs->trans("ShortMonday"), $langs->trans("ShortTuesday"), $langs->trans("ShortWednesday"), $langs->trans("ShortThursday"), $langs->trans("ShortFriday"), $langs->trans("ShortSaturday"));
$tradDaysMin = array($langs->trans("SundayMin"), $langs->trans("MondayMin"), $langs->trans("TuesdayMin"), $langs->trans("WednesdayMin"), $langs->trans("ThursdayMin"), $langs->trans("FridayMin"), $langs->trans("SaturdayMin"));
?>
// For eldy and jQuery date picker
var tradMonths = <?php
echo json_encode($tradMonths);
?>
;
var tradMonthsShort = <?php
echo json_encode($tradMonthsShort);
?>
示例5: get_form
//.........这里部分代码省略.........
if (!empty($this->withbody)) {
$defaultmessage = "";
// TODO A partir du type, proposer liste de messages dans table llx_c_email_template
if ($this->param["models"] == 'facture_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($this->param["models"] == 'facture_relance') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($this->param["models"] == 'propal_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($this->param["models"] == 'order_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($this->param["models"] == 'order_supplier_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($this->param["models"] == 'invoice_supplier_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($this->param["models"] == 'shipping_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($this->param["models"] == 'fichinter_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($this->param["models"] == 'thirdparty') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!is_numeric($this->withbody)) {
$defaultmessage = $this->withbody;
}
// Complete substitution array
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) {
require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
$langs->load('paypal');
if ($this->param["models"] == 'order_send') {
$url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
if ($this->param["models"] == 'facture_send') {
$url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
}
$defaultmessage = str_replace('\\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} else {
if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
}
if (isset($_POST["message"])) {
$defaultmessage = $_POST["message"];
} else {
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
$out .= '<tr>';
$out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>';
$out .= '<td>';
if ($this->withbodyreadonly) {
$out .= nl2br($defaultmessage);
$out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />';
} else {
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if ($this->withfckeditor == -1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$this->withfckeditor = 1;
} else {
$this->withfckeditor = 0;
}
}
$doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72);
$out .= $doleditor->Create(1);
}
$out .= "</td></tr>\n";
}
if ($this->withform == 1 || $this->withform == -1) {
$out .= '<tr><td align="center" colspan="2"><center>';
$out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"';
}
$out .= ' />';
if ($this->withcancel) {
$out .= ' ';
$out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />';
}
$out .= '</center></td></tr>' . "\n";
}
$out .= '</table>' . "\n";
if ($this->withform == 1) {
$out .= '</form>' . "\n";
}
$out .= "<!-- Fin form mail -->\n";
return $out;
}
}
示例6: empty
$restrictviewformytask = empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED) ? 1 : 0;
if (count($tasksarray) > 0) {
$j = 0;
projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse);
} else {
print '<tr><td colspan="10">' . $langs->trans("NoTasks") . '</td></tr>';
}
print "</table>";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button"' . ($disabledtask ? ' disabled' : '') . ' value="' . $langs->trans("Save") . '">';
print '</div>';
print '</form>';
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print ' jQuery(".timesheetalreadyrecorded").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50, content: \'' . dol_escape_js($langs->trans("TimeAlreadyRecorded", $user->getFullName($langs))) . '\'});';
print "});";
print '</script>';
// Add a new project/task
print '<br>';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<input type="hidden" name="action" value="assign">';
print '<input type="hidden" name="mode" value="' . $mode . '">';
print '<input type="hidden" name="year" value="' . $year . '">';
print '<input type="hidden" name="month" value="' . $month . '">';
print '<input type="hidden" name="day" value="' . $day . '">';
print $langs->trans("AssignTaskToMe") . '<br>';
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, 1, 1);
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0);
print '<input type="submit" class="button" name="submit" value="' . $langs->trans("AssignTask") . '">';
print '</form>';
示例7: dol_print_error
$nbtotal = $obj->nb;
} else {
dol_print_error($db);
}
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")) . '<br>' . "\n";
print '<br><input class="button" type="submit" id="submitformbarcodethirdpartygen" ' . (GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode") ? '' : 'disabled ') . 'value="' . $langs->trans("InitEmptyBarCode", $nbno) . '"';
print ' title="' . dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")) . '" disabled';
print '>';
print '<br><br><br><br>';
}
// For products
if ($conf->product->enabled || $conf->product->service) {
// Example 1 : Adding jquery code
print '<script type="text/javascript" language="javascript">
function confirm_erase() {
return confirm("' . dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")) . '");
}
</script>';
$nbno = $nbtotal = 0;
print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'object_product');
print '<br>' . "\n";
$sql = "SELECT count(rowid) as nb, fk_product_type, datec";
$sql .= " FROM " . MAIN_DB_PREFIX . "product";
$sql .= " WHERE barcode IS NULL OR barcode = ''";
$sql .= " GROUP BY fk_product_type, datec";
$sql .= " ORDER BY datec";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
示例8: draw_jflot
//.........这里部分代码省略.........
}
$i++;
}
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
$this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
$this->_stringtoshow .= '<br><div align="center">' . $this->title . '</div><br>';
$this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;"></div>' . "\n";
$this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
$this->_stringtoshow .= '$(function () {' . "\n";
$i = $firstlot;
while ($i < $nblot) {
$this->_stringtoshow .= $serie[$i];
$i++;
}
$this->_stringtoshow .= "\n";
$this->_stringtoshow .= '
function showTooltip_' . $tag . '(x, y, contents) {
$(\'<div id="tooltip_' . $tag . '">\' + contents + \'</div>\').css( {
position: \'absolute\',
display: \'none\',
top: y + 5,
left: x + 5,
border: \'1px solid #ddd\',
padding: \'2px\',
\'background-color\': \'#ffe\',
width: 200,
opacity: 0.80
}).appendTo("body").fadeIn(20);
}
var previousPoint = null;
$("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
/* console.log(item); */
var x = item.datapoint[0].toFixed(2);
var y = item.datapoint[1].toFixed(2);
var z = item.series.xaxis.ticks[item.dataIndex].label;
showTooltip_' . $tag . '(item.pageX, item.pageY,
item.series.label + "<br>" + z + " => " + y);
}
}
else {
$("#tooltip_' . $tag . '").remove();
previousPoint = null;
}
});
';
$this->_stringtoshow .= 'var stack = null, steps = false;' . "\n";
$this->_stringtoshow .= 'function plotWithOptions_' . $tag . '() {' . "\n";
$this->_stringtoshow .= '$.plot($("#placeholder_' . $tag . '"), [ ' . "\n";
$i = $firstlot;
while ($i < $nblot) {
if ($i > $firstlot) {
$this->_stringtoshow .= ', ' . "\n";
}
$color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
$this->_stringtoshow .= '{ ';
if (!isset($this->type[$i]) || $this->type[$i] == 'bars') {
$this->_stringtoshow .= 'bars: { show: true, align: "' . ($i == $firstlot ? 'center' : 'left') . '", barWidth: 0.5 }, ';
}
if (isset($this->type[$i]) && $this->type[$i] == 'lines') {
$this->_stringtoshow .= 'lines: { show: true, fill: false }, ';
}
$this->_stringtoshow .= 'color: "#' . $color . '", label: "' . (isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '') . '", data: d' . $i . ' }';
$i++;
}
$this->_stringtoshow .= "\n" . ' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }' . "\n";
// Xaxis
$this->_stringtoshow .= ', xaxis: { ticks: [' . "\n";
$x = 0;
foreach ($this->data as $key => $valarray) {
if ($x > 0) {
$this->_stringtoshow .= ', ' . "\n";
}
$this->_stringtoshow .= ' [' . $x . ', "' . $valarray[0] . '"]';
$x++;
}
$this->_stringtoshow .= '] }' . "\n";
// Yaxis
$this->_stringtoshow .= ', yaxis: { min: ' . $this->MinValue . ', max: ' . $this->MaxValue . ' }' . "\n";
// Background color
$color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]);
$color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
$this->_stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] } }' . "\n";
//$this->_stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this->_stringtoshow .= '});' . "\n";
$this->_stringtoshow .= '}' . "\n";
$this->_stringtoshow .= 'plotWithOptions_' . $tag . '();' . "\n";
$this->_stringtoshow .= '});' . "\n";
$this->_stringtoshow .= '</script>' . "\n";
}
示例9: constructGanttLine
/**
* Add a gant chart line
*
* @param string $tarr tarr
* @param Task $task Task object
* @param Project $project_dependencies Project object
* @param int $level Level
* @param int $project_id Id of project
* @return void
*/
function constructGanttLine($tarr, $task, $project_dependencies, $level = 0, $project_id = null)
{
$start_date = $task["task_start_date"];
$end_date = $task["task_end_date"];
if (!$end_date) {
$end_date = $start_date;
}
$start_date = dol_print_date($start_date, "%m/%d/%Y");
$end_date = dol_print_date($end_date, "%m/%d/%Y");
// Resources
$resources = $task["task_resources"];
// Define depend (ex: "", "4,13", ...)
$depend = "\"";
$count = 0;
foreach ($project_dependencies as $value) {
// Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt))
if ($value[0] == $task['task_id']) {
$depend .= ($count > 0 ? "," : "") . $value[1];
$count++;
}
}
$depend .= "\"";
// Define parent
if ($project_id && $level < 0) {
$parent = 'p' . $project_id;
} else {
$parent = $task["task_parent"];
}
// Define percent
$percent = $task['task_percent_complete'] ? $task['task_percent_complete'] : 0;
// Link
$link = DOL_URL_ROOT . '/projet/tasks/task.php?withproject=1&id=' . $task["task_id"];
// Name
$name = $task['task_name'];
for ($i = 0; $i < $level; $i++) {
$name = ' ' . $name;
}
// Add line to gantt
$s = "// Add taks id=" . $task["task_id"] . " level = " . $level . "\n";
$s = "g.AddTaskItem(new JSGantt.TaskItem(" . $task['task_id'] . ",'" . dol_escape_js($name) . "','" . $start_date . "', '" . $end_date . "', '" . $task['task_color'] . "', '" . $link . "', " . $task['task_milestone'] . ", '" . $resources . "', " . $percent . ", " . ($task["task_is_group"] > 0 ? 1 : 0) . ", '" . $parent . "', 1, '" . ($depend ? $depend : "") . "'));";
echo $s . "\n";
}
示例10: getBannerAddress
/**
* Return full address of contact
*
* @param string $htmlkey HTML id to make banner content unique
* @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member)
* @return string Full address string
*/
function getBannerAddress($htmlkey, $object)
{
global $conf, $langs;
$countriesusingstate = array('AU', 'US', 'IN', 'GB', 'ES', 'UK', 'TR');
$contactid = 0;
$thirdpartyid = 0;
if ($this->element == 'societe') {
$thirdpartyid = $this->id;
}
if ($this->element == 'contact') {
$contactid = $this->id;
$thirdpartyid = $object->fk_soc;
}
if ($this->element == 'user') {
$contactid = $this->contact_id;
$thirdpartyid = $object->fk_soc;
}
$out = '<!-- BEGIN part to show address block -->';
$outdone = 0;
$coords = $this->getFullAddress(1, ', ');
if ($coords) {
if (!empty($conf->use_javascript_ajax)) {
$namecoords = $this->getFullName($langs, 1) . '<br>' . $coords;
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
$out .= '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\'' . dol_escape_js($namecoords) . '\',\'' . dol_escape_js($langs->trans("HelpCopyToClipboard")) . '\');">';
$out .= img_picto($langs->trans("Address"), 'object_address.png');
$out .= '</a> ';
}
$out .= dol_print_address($coords, 'address_' . $htmlkey . '_' . $this->id, $this->element, $this->id, 1);
$outdone++;
$outdone++;
}
if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) && !empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) {
$out .= ($outdone ? '<br>' : '') . $this->state;
$outdone++;
}
if (!empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) {
$out .= $outdone ? '<br>' : '';
}
if (!empty($this->phone) && empty($this->phone_pro)) {
// For objects that store pro phone into ->phone
$out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
$outdone++;
}
if (!empty($this->phone_pro)) {
$out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
$outdone++;
}
if (!empty($this->phone_mobile)) {
$out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhoneMobile"));
$outdone++;
}
if (!empty($this->phone_perso)) {
$out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso"));
$outdone++;
}
if (!empty($this->fax)) {
$out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
$outdone++;
}
if (!empty($this->office_phone)) {
$out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
$outdone++;
}
if (!empty($this->user_mobile)) {
$out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhoneMobile"));
$outdone++;
}
if (!empty($this->office_fax)) {
$out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
$outdone++;
}
$out .= '<div style="clear: both;"></div>';
$outdone = 0;
if (!empty($this->email)) {
$out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
$outdone++;
}
if (!empty($this->url)) {
$out .= dol_print_url($this->url, '', 0, 1);
$outdone++;
}
if (!empty($conf->skype->enabled)) {
$out .= '<div style="clear: both;"></div>';
if ($this->skype) {
$out .= dol_print_skype($this->skype, $this->id, $object->id, 'AC_SKYPE');
}
$outdone++;
}
$out .= '<!-- END Part to show address block -->';
return $out;
}
示例11: assign_values
/**
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param integer $id Id of object
* @param string $ref Ref of object
* @return void
*/
function assign_values(&$action, $id = 0, $ref = '')
{
global $conf, $langs, $user, $mysoc;
global $form, $formadmin, $formcompany;
$ret = $this->getObject($id, $ref);
parent::assign_values($action);
$this->tpl['title'] = load_fiche_titre($this->getTitle($action));
$this->tpl['profid1'] = $this->object->idprof1;
$this->tpl['profid2'] = $this->object->idprof2;
$this->tpl['profid3'] = $this->object->idprof3;
$this->tpl['profid4'] = $this->object->idprof4;
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) {
$js = "\n";
$js .= '<script language="JavaScript" type="text/javascript">';
$js .= "function CheckVAT(a) {\n";
$js .= "newpopup('" . DOL_URL_ROOT . "/societe/checkvat/checkVatPopup.php?vatNumber='+a,'" . dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")) . "',500,230);\n";
$js .= "}\n";
$js .= '</script>';
$js .= "\n";
$this->tpl['js_checkVatPopup'] = $js;
}
if ($action == 'create' || $action == 'edit') {
for ($i = 1; $i <= 4; $i++) {
$this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code);
$this->tpl['showprofid' . $i] = $formcompany->get_input_id_prof($i, 'idprof' . $i, $this->tpl['profid' . $i], $this->object->country_code);
}
// Type
$this->tpl['select_companytype'] = $form->selectarray("typent_id", $formcompany->typent_array(0), $this->object->typent_id);
// Juridical Status
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code);
// Workforce
$this->tpl['select_workforce'] = $form->selectarray("effectif_id", $formcompany->effectif_array(0), $this->object->effectif_id);
// VAT intra
$s = '<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">';
if (empty($conf->global->MAIN_DISABLEVATCHECK)) {
$s .= ' ';
if ($conf->use_javascript_ajax) {
$s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
} else {
$this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>';
}
} else {
$this->tpl['tva_intra'] = $s;
}
} else {
// Confirm delete third party
if ($action == 'delete') {
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . $this->object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "1,action-delete");
}
for ($i = 1; $i <= 4; $i++) {
$this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code);
$this->tpl['checkprofid' . $i] = $this->object->id_prof_check($i, $this->object);
$this->tpl['urlprofid' . $i] = $this->object->id_prof_url($i, $this->object);
}
// TVA intra
if ($this->object->tva_intra) {
$s = $this->object->tva_intra;
$s .= '<input type="hidden" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">';
if (empty($conf->global->MAIN_DISABLEVATCHECK)) {
$s .= ' ';
if ($conf->use_javascript_ajax) {
$s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
} else {
$this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>';
}
} else {
$this->tpl['tva_intra'] = $s;
}
} else {
$this->tpl['tva_intra'] = ' ';
}
// Parent company
if ($this->object->parent) {
$socm = new Societe($this->db);
$socm->fetch($this->object->parent);
$this->tpl['parent_company'] = $socm->getNomUrl(1) . ' ' . ($socm->code_client ? "(" . $socm->code_client . ")" : "");
$this->tpl['parent_company'] .= $socm->town ? ' - ' . $socm->town : '';
} else {
$this->tpl['parent_company'] = $langs->trans("NoParentCompany");
}
}
}
示例12: formconfirm
//.........这里部分代码省略.........
if (!is_int($useajax)) {
$button = $useajax;
$useajax = 1;
$autoOpen = false;
$dialogconfirm .= '-' . $button;
}
$pageyes = $page . '&action=' . $action . '&confirm=yes';
$pageno = $useajax == 2 ? $page . '&confirm=no' : '';
// New code using jQuery only
$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
if (!empty($more)) {
$formconfirm .= '<p>' . $more . '</p>';
}
$formconfirm .= img_help('', '') . ' ' . $question;
$formconfirm .= '</div>' . "\n";
$formconfirm .= '<script type="text/javascript">
$(function() {
var choice=\'ko\';
var $inputarray=' . json_encode($inputarray) . ';
var button=\'' . $button . '\';
var dialogconfirm=\'' . $dialogconfirm . '\';
$( "#" + dialogconfirm ).dialog({
autoOpen: ' . ($autoOpen ? 'true' : 'false') . ',
resizable: false,
height:' . $height . ',
width:' . $width . ',
modal: true,
closeOnEscape: false,
close: function(event, ui) {
if (choice == \'ok\') {
var options="";
if ($inputarray.length>0) {
$.each($inputarray, function() {
var inputname = this;
var inputvalue = $("#" + this).val();
options += \'&\' + inputname + \'=\' + inputvalue;
});
//alert( options );
}
location.href=\'' . $pageyes . '\' + options;
}
' . ($pageno ? 'if (choice == \'ko\') location.href=\'' . $pageno . '\';' : '') . '
},
buttons: {
\'' . dol_escape_js($langs->transnoentities("Yes")) . '\': function() {
choice=\'ok\';
$(this).dialog(\'close\');
},
\'' . dol_escape_js($langs->transnoentities("No")) . '\': function() {
choice=\'ko\';
$(this).dialog(\'close\');
}
}
});
if (button.length > 0) {
$( "#" + button ).click(function() {
$( "#" + dialogconfirm ).dialog( \'open\' );
});
}
});
</script>';
$formconfirm .= "\n";
} else {
$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">';
$formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
$formconfirm .= '<table width="100%" class="valid">' . "\n";
// Ligne titre
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n";
// Ligne formulaire
if ($more) {
$formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n";
$formconfirm .= $more;
$formconfirm .= '</td></tr>' . "\n";
}
// Ligne message
$formconfirm .= '<tr class="valid">';
$formconfirm .= '<td class="valid">' . $question . '</td>';
$formconfirm .= '<td class="valid">';
$newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice;
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice);
$formconfirm .= '</td>';
$formconfirm .= '<td class="valid" align="center"><input class="button" type="submit" value="' . $langs->trans("Validate") . '"></td>';
$formconfirm .= '</tr>' . "\n";
$formconfirm .= '</table>' . "\n";
if (is_array($formquestion)) {
foreach ($formquestion as $key => $input) {
if ($input['type'] == 'hidden') {
$formconfirm .= '<input type="hidden" name="' . $input['name'] . '" value="' . $input['value'] . '">';
}
}
}
$formconfirm .= "</form>\n";
$formconfirm .= '<br>';
}
$formconfirm .= "<!-- end form_confirm -->\n";
return $formconfirm;
}
示例13: show_contacts
//.........这里部分代码省略.........
// Lien click to dial
print '<td>';
print dol_print_phone($obj->phone, $country_code['code'], $obj->rowid, $object->id, 'AC_TEL');
print '</td>';
print '<td>';
print dol_print_phone($obj->phone_mobile, $country_code['code'], $obj->rowid, $object->id, 'AC_TEL');
print '</td>';
print '<td>';
print dol_print_phone($obj->fax, $country_code['code'], $obj->rowid, $object->id, 'AC_FAX');
print '</td>';
print '<td>';
print dol_print_email($obj->email, $obj->rowid, $object->id, 'AC_EMAIL');
print '</td>';
if (!empty($conf->skype->enabled)) {
print '<td>';
print dol_print_skype($obj->skype, $obj->rowid, $object->id, 'AC_SKYPE');
print '</td>';
}
// Status
print '<td>' . $contactstatic->getLibStatut(5) . '</td>';
print '<td align="center">';
if (!empty($conf->use_javascript_ajax)) {
// Copy to clipboard
$coords = '';
if (!empty($object->name)) {
$coords .= $object->name . "<br>";
}
$coords .= $contactstatic->getFullName($langs, 1) . ' ';
$coords .= "<br>";
if (!empty($obj->address)) {
$coords .= dol_nl2br($obj->address, 1, true) . "<br>";
if (!empty($obj->zip)) {
$coords .= $obj->zip . ' ';
}
if (!empty($obj->town)) {
$coords .= $obj->town;
}
if (!empty($obj->country_id)) {
$coords .= "<br>" . $country_code['label'];
}
} else {
if (!empty($object->address)) {
$coords .= dol_nl2br($object->address, 1, true) . "<br>";
if (!empty($object->zip)) {
$coords .= $object->zip . ' ';
}
if (!empty($object->town)) {
$coords .= $object->town;
}
if (!empty($object->country_id)) {
$coords .= "<br>" . $country_code['label'];
}
}
}
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
print '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\'' . dol_escape_js($coords) . '\',\'' . dol_escape_js($langs->trans("HelpCopyToClipboard")) . '\');">';
print img_picto($langs->trans("Address"), 'object_address.png');
print '</a>';
}
print '</td>';
// Add to agenda
if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
print '<td align="center">';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<a class="hideonsmartphone" href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
print img_object($langs->trans("Rendez-Vous"), "action_rdv");
print '</a> ';
}
print '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&actioncode=&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
print img_object($langs->trans("Event"), "action");
print '</a></td>';
}
// Edit
if ($user->rights->societe->contact->creer) {
print '<td align="right">';
print '<a href="' . DOL_URL_ROOT . '/contact/fiche.php?action=edit&id=' . $obj->rowid . '&backtopage=' . urlencode($backtopage) . '">';
print img_edit();
print '</a></td>';
} else {
print '<td> </td>';
}
print "</tr>\n";
$i++;
}
} else {
print "<tr " . $bc[$var] . ">";
print '<td colspan="' . $colspan . '">' . $langs->trans("None") . '</td>';
print "</tr>\n";
}
print "\n</table>\n";
print '</form>' . "\n";
print "<br>\n";
?>
<div id="dialog" title="<?php
echo dol_escape_htmltag($langs->trans('Address'));
?>
" style="display: none;"></div>
<?php
return $i;
}
示例14: select_color
/**
* Output a HTML code to select a color
* @param set_color Pre-selected color
* @param prefix Name of HTML field
* @param form_name Name of form
* @param showcolorbox 1=Show color code and color box, 0=Show only color code
* @param arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
*/
function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='')
{
global $langs;
if (! is_array($arrayofcolors) || sizeof($arrayofcolors) < 1)
{
$langs->load("other");
print '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
print '<script type="text/javascript">
jQuery(document).ready(function(){
$(\'#colorpicker'.$prefix.'\').jPicker( {
window: {
title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */
effects:
{
type: \'show\', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */
speed:
{
show: \'fast\', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */
hide: \'fast\' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */
}
},
position:
{
x: \'screenCenter\', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */
y: \'center\' /* acceptable values "top", "bottom", "center", or relative px value */
},
},
images: {
clientPath: \''.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/images/\',
picker: { file: \'../../../../../theme/common/colorpicker.png\', width: 14, height: 14 }
},
localization: // alter these to change the text presented by the picker (e.g. different language)
{
text:
{
title: \''.dol_escape_js($langs->trans("SelectAColor")).'\',
newColor: \''.dol_escape_js($langs->trans("New")).'\',
currentColor: \''.dol_escape_js($langs->trans("Current")).'\',
ok: \''.dol_escape_js($langs->trans("Change")).'\',
cancel: \''.dol_escape_js($langs->trans("Cancel")).'\'
}
}
} ); });
</script>';
print '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat" type="text" value="'.$set_color.'" />';
/*
// No list of colors forced, we can suggest any color
print "\n".'<table class="nobordernopadding"><tr><td valign="middle">';
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_colorpicker.js"></script>'."\n";
print '<script type="text/javascript">
window.onload = function()
{
fctLoad();
}
window.onscroll = function()
{
fctShow();
}
window.onresize = function()
{
fctShow();
}
</script>'."\n";
print '<input type="text" size="10" name="'.$prefix.'" value="'.$set_color.'" maxlength="7" class="flat">'."\n";
print '</td><td valign="middle">';
print '<img src="'.DOL_URL_ROOT.'/theme/common/colorpicker.png" width="21" height="18" border="0" onClick="fctShow(document.'.$form_name.'.'.$prefix.');" style="cursor:pointer;">'."\n";
print '</td>';
if ($showcolorbox)
{
print '<td style="padding-left: 4px" nowrap="nowrap">';
print '<!-- Box color '.$set_color.' -->';
print '<table style="border-collapse: collapse; margin:0px; padding: 0px; border: 1px solid #888888; background: #'.(preg_replace('/#/','',$set_color)).';" width="12" height="10">';
print '<tr class="nocellnopadd"><td></td></tr>';
print '</table>';
print '</td>';
}
print '</tr></table>';
*/
}
else // In most cases, this is not used. We used instead function with no specific list of colors
{
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';
print '<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(\'#colorpicker'.$prefix.'\').colorpicker({
size: 14,
label: \'\',
//.........这里部分代码省略.........
示例15: dol_escape_js
?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<script type="text/javascript">
<?php
$openeddir = '/';
?>
$(document).ready(function() {
$('#filetree').fileTree({
root: '<?php
print dol_escape_js($openeddir);
?>
',
// Ajax called if we click to expand a dir (not a file). Parameter of dir is provided as a POST parameter.
script: '<?php
echo DOL_URL_ROOT . '/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir=' . urlencode($openeddir);
?>
',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)
function(file) {
$("#mesg").hide();
loadandshowpreview(file,0);
},
// Called if we click on a dir (not a file)