17 $monLibrary = dirname(__FILE__) .
"/../library";
18 $monIncludes = dirname(__FILE__) .
"/../includes";
19 require_once(
"$monLibrary/cu_top.i");
20 require_once(
"$monLibrary/ck_hticket.i");
21 require_once(
"$monIncludes/cu_remote_top.prg");
25 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
28 header(
"Location: /hcuadm/hcu_noperm.prg");
33 $availableLanguages = array();
34 $availableLanguages[] = array(
"lang" =>
"en_US",
"display" =>
"English" );
35 $availableLanguages[] = array(
"lang" =>
"es_US",
"display" =>
"Spanish" );
36 $availableLanguages[] = array(
"lang" =>
"pl_US",
"display" =>
"Polish" );
38 $dms_ok = array(
"act"=>
"digits",
"docsid"=>
"string",
"docsname"=>
"string",
"language"=>
"string",
39 "docsdesc"=>
"string",
"docstitle"=>
"string",
"docstype"=>
"string",
"docsdisplaylink"=>
"string",
40 "docsdisplaytext"=>
"string",
"docsdefaultavail"=>
"string",
"docsresponsetype"=>
"string",
41 'docsmaintsection'=>
'string',
'docsmaintsort'=>
'digits',
"docstarget" =>
"string",
"docstargetname" =>
"string",
42 "Remote_Update"=>
"array",
'script_doc'=>
'string',
"skeleton_file"=>
"string",
43 "o"=>
"digits",
"d"=>
"digits",
'msg'=>
'string');
46 $o = isset($o) ? $o : 0;
47 $language = isset($language) ? $language :
"";
48 $docsdisplaylink = isset($docsdisplaylink) ? $docsdisplaylink :
"";
49 $docsdefaultavail = isset($docsdefaultavail) ? $docsdefaultavail :
"";
54 if ( $language ==
"" ) $language =
"en_US";
57 $sectionMaster = Array(
68 $self = $_SERVER[
'SCRIPT_NAME'];
70 if (!isset($act)) $act =
"2";
79 if (!strlen(trim($docsname))) {
80 $error_msg .=
"<li>A document name is needed.<br></li>";
84 if ( ( $docsresponsetype ==
"D" ||
85 $docsresponsetype ==
"T" ) &&
86 strlen( trim( $docsdisplaytext ) ) == 0 ) {
87 $error_msg .=
"<li>Display link text is needed for this Document Response Type (the Allow Display Link is optional).<br></li>";
90 if ($error_msg ==
'') {
95 $save_sql =
"SELECT docsname FROM cucmsdocs WHERE docsid = '$docsid'";
97 $db_result = db_query($save_sql, $link);
98 $num_rows = db_num_rows($db_result);
102 if ($num_rows > 0 ) {
104 $qry_stmt =
"UPDATE cucmsdocs 105 SET docsname = '" . prep_save($docsname, 50) .
"', 106 docsdesc = '" . prep_save($docsdesc, 250) .
"', 107 docstitle = '" . prep_save($docstitle, 100) .
"', 108 docstype = $docstype, 109 docsdisplaylink = '$docsdisplaylink', 110 docsdisplaytext = '" . prep_save($docsdisplaytext, 100) .
"', 111 docsdefaultavail = '$docsdefaultavail', 112 docsresponsetype = '$docsresponsetype', 113 docsmaintsection = '" . prep_save($docsmaintsection, 30) .
"', 114 docsmaintsort = '" . intval($docsmaintsort) .
"', 115 docstarget = '" . prep_save($docstarget, 20) .
"', 116 docstargetname = '" . prep_save($docstargetname, 100) .
"' 117 WHERE docsid = '" . intval($docsid) .
"' ";
120 $testSql =
"SELECT docsid FROM cucmsdocs WHERE docsname = '$docsname'";
121 $testRS = db_query($testSql, $link);
122 list($testId) = db_fetch_array($testRS);
123 db_free_result($testRS);
125 $error_msg =
"Your Custom Content File Name is already used. Please choose a different one.";
127 $idsql =
"SELECT nextval('cucmsdocs_docsid_seq');";
128 $idrs = db_query($idsql, $link);
129 list($save_id) = db_fetch_array($idrs);
130 db_free_result($idrs);
132 $qry_stmt =
"INSERT INTO cucmsdocs 133 (docsid, docsname, docsdesc, docstitle, docstype, docsdisplaylink, 134 docsdisplaytext, docsdefaultavail, docsresponsetype, 135 docsmaintsection, docsmaintsort, docstarget, docstargetname) 138 '" . prep_save($docsname, 50) .
"', 139 '" . prep_save($docsdesc, 250) .
"', 140 '" . prep_save($docstitle, 100) .
"', 142 '" . $docsdisplaylink .
"', 143 '" . prep_save($docsdisplaytext, 100) .
"', 144 '" . $docsdefaultavail .
"', 145 '" . $docsresponsetype .
"', 146 '" . prep_save($docsmaintsection, 30) .
"', 147 '" . intval($docsmaintsort) .
"', 148 '" . prep_save($docstarget, 20) .
"', 149 '" . prep_save($docstargetname, 100) .
"') ";
154 if ($error_msg ==
'') {
155 if (!($db_result=db_query($qry_stmt, $link))) {
156 $error_msg =
"A problem occurred while saving your information, you may want to try later .";
159 $Remote_Results =
"";
161 if (Remote_Update_Selected()) {
162 if ($num_rows == 0) {
163 $remote_doc_id = intval($save_id);
165 $remote_doc_id = intval($docsid);
170 Remote_Field_Add(
"cucmsdocs",
"docsid", $remote_doc_id);
171 Remote_Field_Add(
"cucmsdocs",
"docsname", $docsname);
172 Remote_Field_Add(
"cucmsdocs",
"docsdesc", $docsdesc);
173 Remote_Field_Add(
"cucmsdocs",
"docstitle", $docstitle);
174 Remote_Field_Add(
"cucmsdocs",
"docstype", $docstype);
175 Remote_Field_Add(
"cucmsdocs",
"docsdisplaylink", $docsdisplaylink);
176 Remote_Field_Add(
"cucmsdocs",
"docsdisplaytext", $docsdisplaytext);
177 Remote_Field_Add(
"cucmsdocs",
"docsdefaultavail", $docsdefaultavail);
178 Remote_Field_Add(
"cucmsdocs",
"docsresponsetype", $docsresponsetype);
179 Remote_Field_Add(
"cucmsdocs",
"docsmaintsection", $docsmaintsection);
180 Remote_Field_Add(
"cucmsdocs",
"docsmaintsort", $docsmaintsort);
181 Remote_Field_Add(
"cucmsdocs",
"docstarget", $docstarget);
182 Remote_Field_Add(
"cucmsdocs",
"docstargetname", $docstargetname);
185 $Remote_Results = Remote_Update_Send(
"U",
"cucmsdocs");
190 header (
"Location: $self?msg=" . urlencode(
"The information was saved!<br>$Remote_Results"));
196 if ( strlen( $error_msg ) > 0 ) {
198 $error_msg =
"The following problems were found with the information given.<br>Please correct this and try again.<br><br>$error_msg";
202 } elseif ($act ==
"5") {
203 $sql =
"DELETE FROM cucmsdocs 204 WHERE docsid = '" . intval($docsid) .
"' ";
206 if (!($db_result=db_query($sql, $link))) {
207 header (
"Location: $self?msg=" . urlencode(
"A problem occurred while deleting the custom file entry, you may want to try later."));
211 if (Remote_Update_Selected()) {
214 Remote_Field_Add(
"cucmsdocs",
"docsid", intval($docsid));
217 $Remote_Results = Remote_Update_Send(
"D",
"cucmsdocs");
221 header (
"Location: $self?msg=" . urlencode(
"The entry was deleted!"));
229 cu_header(
"Credit Union Custom Content");
231 <form action=
"<?php echo $self; ?>?act=3" method=
"post">
237 if (isset($docsid)) {
238 $query =
"select * from cucmsdocs where docsid = '$docsid' and docstype in (1,2,3)";
239 $result = db_query($query, $link);
241 $docsRow = db_fetch_object($result);
242 $num_rows = db_num_rows($result);
248 if (isset($form_err) && strlen($form_err) > 0)
249 printf(
"\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
252 <table width=
"80%" cellpadding=
"2" cellspacing=
"0" border=
"0" class=
"dmsbg"><tr><td>
253 <table width=
"100%" cellpadding=
"1" cellspacing=
"0" border=
"0" bgcolor=white>
255 <td colspan=
"2" class=
"bar" align=
"center">
256 <?php
if($num_rows > 0): ?>
258 <input type=
"hidden" name=
"docsid" value=
"<?php echo $docsRow->docsid; ?>">
264 <?php
if ($error_msg !=
''): ?>
266 <td colspan=
"2" align=
"center" class=
"err">
267 <?php echo $error_msg; ?>
272 <td nowrap align=
"right" class=
"hdr">
275 <td nowrap
class=
"dtl">
278 if ( isset($docsname))
279 $cu_info = trim($docsname);
280 elseif ($num_rows > 0)
281 $cu_info = htmlspecialchars(trim($docsRow->docsname));
283 <input type="text" name="docsname" size="50" maxlength="50" value="<?php echo $cu_info ?>">
287 <td nowrap align="right" class="hdr" valign="top">
288 Document Description:
290 <td nowrap class="dtl">
293 if ( isset($docsdesc))
294 $cu_info = set_string($docsdesc);
295 else if ($num_rows > 0)
296 $cu_info = htmlspecialchars(trim($docsRow->docsdesc));
298 <textarea name="docsdesc" rows="10" cols="40"><?php echo $cu_info; ?></textarea>
299 (If a Notice, used in CU Admin "Reset Popups and Promos" so it needs to be understandable and not changing.)
303 <td nowrap align="right" class="hdr">
306 <td nowrap class="dtl">
309 if ( isset($docstitle))
310 $cu_info = trim($docstitle);
311 else if ($num_rows > 0)
312 $cu_info = htmlspecialchars(trim($docsRow->docstitle));
314 <input type='text' name='docstitle' value='<?php echo $cu_info ?>'> (If a Notice or Terms, used in Disclosures page; needs to be in the Dictionary)
318 <td nowrap align="right" class="hdr">
321 <td nowrap class="dtl">
324 if ( isset($docstype))
325 $cu_info = $docstype;
326 else if ($num_rows > 0)
327 $cu_info = $docsRow->docstype;
329 <select name='docstype'>
330 <option value='1' <?php echo ($cu_info == '1' ? "SELECTED" : "") ?>>Stand Alone</option>
331 <option value='2' <?php echo ($cu_info == '2' ? "SELECTED" : "") ?>>Fragment</option>
332 <option value='3' <?php echo ($cu_info == '3' ? "SELECTED" : "") ?>>Complex Form</option>
335 (Stand Alone is a complete HTML document; complex form causes TinyMCE editor to not be used; mobile template places it in CU's mobile directory.)
339 <td nowrap align="right" class="hdr">
342 <td nowrap class="dtl">
346 $cu_info = $docsRow->docsdisplaylink == "Y" ? "checked='CHECKED'" : "";
347 else if (isset($docsdisplaylink))
348 $cu_info = $docsdisplaylink == "Y" ? "checked='CHECKED'" : "";
350 <input type='checkbox' value='Y' name='docsdisplaylink' <?php echo $cu_info ?>> Allow
354 <td nowrap align="right" class="hdr">
357 <td nowrap class="dtl">
360 if ( isset($docsdisplaytext))
361 $cu_info = trim($docsdisplaytext);
362 else if ($num_rows > 0)
363 $cu_info = htmlspecialchars(trim($docsRow->docsdisplaytext));
366 <input type='text' name='docsdisplaytext' value='<?php echo $cu_info ?>'> (Link phrase needs to be in the Dictionary)
370 <td nowrap align="right" class="hdr">
371 Default Script Available?:
373 <td nowrap class="dtl">
377 $cu_info = $docsRow->docsdefaultavail == "Y" ? "checked='CHECKED'" : "";
378 else if (isset($docsdefaultavail))
379 $cu_info = $docsdefaultavail == "Y" ? "checked='CHECKED'" : "";
381 <input type='checkbox' value='Y' name='docsdefaultavail' <?php echo $cu_info ?>> Available
385 <td nowrap align="right" class="hdr">
388 <td nowrap class="dtl">
391 if ( isset($docsresponsetype))
392 $cu_info = $docsresponsetype;
393 else if ($num_rows > 0)
394 $cu_info = $docsRow->docsresponsetype;
396 <select name='docsresponsetype'>
397 <option value='N' <?php echo ($cu_info == 'N' ? "SELECTED" : "") ?>>None</option>
398 <option value='T' <?php echo ($cu_info == 'T' ? "SELECTED" : "") ?>>Terms of Use</option>
399 <option value='D' <?php echo ($cu_info == 'D' ? "SELECTED" : "") ?>>Notice/Disclaimer</option>
400 <option value='A' <?php echo ($cu_info == 'A' ? "SELECTED" : "") ?>>Promo/All Members</option>
401 <option value='E' <?php echo ($cu_info == 'E' ? "SELECTED" : "") ?>>Promo/No E-Statements</option>
402 <option value='P' <?php echo ($cu_info == 'P' ? "SELECTED" : "") ?>>Promo/Persistent</option>
407 <td nowrap align="right" class="hdr">
408 Content Maintenance Section
410 <td nowrap class="dtl">
413 if ( isset($docsmaintsection))
414 $cu_info = set_string($docsmaintsection);
415 else if ($num_rows > 0)
416 $cu_info = htmlspecialchars(trim($docsRow->docsmaintsection));
418 $cu_info = ($cu_info == '' ? $sectionMaster[0] : $cu_info);
420 <select name="docsmaintsection" size=1>
421 <?php foreach ($sectionMaster as $sectionValue) : ?>
422 <option value="<?php echo $sectionValue; ?>" <?php echo ($cu_info == $sectionValue ? "SELECTED" : ""); ?>><?php echo $sectionValue; ?></option>
428 <td nowrap align="right" class="hdr">
429 Content Maintenance Sort Value:
431 <td nowrap class="dtl">
434 if ( isset($docsmaintsort))
435 $cu_info = $docsmaintsort;
436 else if ($num_rows > 0)
437 $cu_info = $docsRow->docsmaintsort;
439 <input type='number' name='docsmaintsort' value='<?php echo $cu_info ?>' min='0' max='500'>
443 <td nowrap align="right" class="hdr">Target Directory:</td>
444 <td nowrap class="dtl">
445 <select name='docstarget'>
448 if (isset($docstarget))
449 $cu_info = trim($docstarget);
450 else if ($num_rows > 0)
451 $cu_info = htmlspecialchars(trim($docsRow->docstarget));
453 <option value='' <?php echo ($cu_info == "" ? "SELECTED" : ""); ?>>(Default)</option>
454 <option value='public_html' <?php echo ($cu_info == "public_html" ? "SELECTED" : ""); ?>>Public HTML</option>
455 <option value='mobile' <?php echo ($cu_info == "mobile" ? "SELECTED" : ""); ?>>Mobile</option>
458 (Default goes to /home/CUCODE/public_html/bankingIncludes/, public HTML: /home/CUCODE/public_html/ and mobile: /home/CUCODE/public_html/mobile.)
461 <td nowrap align="right" class="hdr">Target Name:</td>
462 <td nowrap class="dtl">
464 if (isset($docstargetname))
465 $cu_info = trim($docstargetname);
466 else if ($num_rows > 0)
467 $cu_info = htmlspecialchars(trim($docsRow->docstargetname));
469 <input type="
string" name="docstargetname" value='<?php echo $cu_info; ?>'>
473 <td class='dtl'> </td>
474 <td nowrap class='dtl'>
476 <td class='dtl'> </td>
477 <td nowrap class='dtl'>
478 <?php remote_update_list(); ?>
482 <td class='dtl'> </td>
483 <td nowrap class='dtl' colspan="1">
484 <input type="submit" name="Save" Value="Save">
485 <input type="button" name="Cancel" Value="Cancel" onClick="document.location='<?php echo $self; ?>'">
491 if (isset($form_err)) {
495 echo
"</td></tr></table>";
498 cu_header(
"CU Message List");
507 $order_by =
"lower(docsdesc)";
512 $order_by =
"docstype";
517 $order_by =
"lower(docsdisplaytext)";
522 $order_by =
"lower(docsresponsetype)";
527 $order_by =
"lower(docsname)";
533 $order_by .=
" desc";
537 reset($sectionMaster);
538 $order_by =
"CASE WHEN coalesce(docsmaintsection, '') = '' THEN 0 ";
539 foreach ($sectionMaster as $sectionKey => $sectionValue) {
540 $order_by .=
" WHEN docsmaintsection = '$sectionValue' THEN $sectionKey ";
542 $order_by .=
"ELSE 0 END, docsmaintsort, lower(docsname)";
544 $query =
"SELECT *, case when coalesce(docsmaintsection, '') = '' then '{$sectionMaster[0]}' else docsmaintsection end as docssectionname 545 FROM cucmsdocs where docstype in (1,2,3) 546 ORDER BY $order_by ";
547 $prod_result = db_query($query, $link);
551 <!-- Print out the top of the table -->
553 <table border=
"0" cellpadding=
"2" callspacing=
"0" align=
"center" width=
"80%" class=
"dmsbg"><tr><td>
554 <table border=
"0" cellpadding=2 cellspacing=
"0" align=
"center" width=
"100%">
556 <td colspan=
"<?php echo $numColumns; ?>" class=
"bar" align=
"center">
557 CU Admin Custom Content File List
560 <?php
if (isset($msg)): ?>
562 <td colspan=
"<?php echo $numColumns; ?>" class=
"err" align=
"center">
563 <font color=
"#FF8080"><?php echo $msg; ?></font>
568 <td colspan=
"<?php echo $numColumns; ?>" class=
"dtl">
569 <a href=
"<?php echo $self; ?>?act=1" target=
"_parent">Add Custom Content File</a>
571 <a href=
"<?php echo $infourl ?>/hcuadm/cuilist.prg" target=
"_parent">Credit Union List</a>
575 <td
class=
"hdr" align=
"left" valign=
"top" nowrap>
578 <td
class=
"hdr" align=
"left" valign=
"top" nowrap>
581 <td
class=
"hdr" align=
"left" valign=
"top" nowrap>
584 <td
class=
"hdr" align=
"left" valign=
"top" nowrap>
587 <td
class=
"hdr" align=
"left" valign=
"top">
590 <td
class=
"hdr" align=
"left" valign=
"top">
593 <td
class=
"hdr" align=
"left" valign=
"top">
596 <td
class=
"hdr" align=
"left" valign=
"top">
599 <td
class=
"hdr" align=
"left" valign=
"top">
602 <td
class=
"hdr" align=
"left" valign=
"top">
605 <td
class=
"hdr" align=
"left" valign=
"top">
608 <td
class=
"hdr" align=
"center" valign=
"top">
611 <td
class=
"hdr" align=
"center" valign=
"top">
612 Skeleton<br>Create/Edit
614 <td
class=
"hdr" align=
"center" valign=
"top">
617 <td
class=
"hdr" align=
"center" valign=
"top">
624 $currentSection =
'';
625 while ($prod_row = db_fetch_object($prod_result, $row)):
627 if ($currentSection != $prod_row->docssectionname) :
628 $currentSection = $prod_row->docssectionname;
630 <tr
class=
"" style=
'background:#fff;'>
631 <td colspan=
'<?php echo $numColumns; ?>' style=
'padding:5px 0 5px 0;text-align:center;'>
632 <span style=
'color: #333; font-size: 14pt;'>Content Section: <?php echo $currentSection; ?></span>
636 <tr
class=
"<?php echo $RGB; ?>_small">
637 <td nowrap valign=
"top">
638 <?php echo trim($prod_row->docsname) ?>
640 <td valign=
"top" style=
"max-width:50px;">
641 <?php echo trim($prod_row->docsmaintsort); ?>
643 <td valign=
"top" style=
"max-width:250px;">
644 <?php echo trim($prod_row->docsdesc); ?>
648 echo trim($prod_row->docstitle);
651 <td nowrap valign=
"top">
653 switch ($prod_row->docstype) {
667 <?php echo trim($prod_row->docsdisplaylink) ?>
670 <?php echo trim($prod_row->docsdisplaytext) ?>
673 <?php echo ( trim($prod_row->docsdefaultavail) ==
"Y" ?
"Y" :
"" ) ?>
675 <td nowrap valign=
"top">
677 switch ($prod_row->docsresponsetype) {
688 echo
"Promo/All Members";
691 echo
"Promo/No E-Statements";
694 echo
"Promo/Persistent";
700 <?php echo(trim($prod_row->docstarget) ==
"" ?
"-" : trim($prod_row->docstarget)); ?>
703 <?php echo(trim($prod_row->docstargetname) ==
"" ?
"-" : trim($prod_row->docstargetname)); ?>
705 <td nowrap valign=
"top">
706 <a href=
"<?php echo $self; ?>?act=1&docsid=<?php echo trim($prod_row->docsid) ?>">Edit</a>
708 <a href=
"<?php echo $self; ?>?act=4&docsid=<?php echo trim($prod_row->docsid) ?>">Delete</a>
710 <td nowrap valign=
"top">
711 <select onchange=
'if (this.value) { location.href="<?php echo $self; ?>?act=33&docsid=<?php echo trim($prod_row->docsid) ?>&language="+this.value; }'>
712 <option value=
"">Language...</option>
714 for ( $i = 0; $i < count( $availableLanguages ); $i++ ) {
715 print
"<option value='{$availableLanguages[$i]["lang
"]}'>{$availableLanguages[$i]["display
"]}</option>";
723 $canExportSkeleton =
false;
724 for ( $i = 0; $i < count( $availableLanguages ); $i++ ) {
726 $skelFile =
"skel_" . trim($prod_row->docsname);
729 $hasSkeleton =
false;
731 if ( file_exists(
"$skeletonLocation/{$availableLanguages[$i]["lang
"]}/$skelFile") ) {
733 $canExportSkeleton =
true;
735 $color = $hasSkeleton ?
"green" :
"red";
736 $letter = substr( $availableLanguages[$i][
"display"], 0 , 1 );
737 print
"<span style='background-color:{$color}'>{$letter}</span>";
741 <td nowrap valign=
"top">
743 if ( $prod_row->docsdefaultavail ==
"Y" ) {
744 if ( $canExportSkeleton ) {
746 <button type=
'button' onClick=
'location.href="<?php echo $self; ?>?act=55&docsid=<?php echo trim($prod_row->docsid) ?>"'>Export</button>
749 print
"<span style='font-size:smaller; color:darkgray;'>Need<br>Skeleton</span>";
761 if ( $prod_row->docsresponsetype ==
"P" ) {
762 print
"<tr class='{$RGB}_small'><td colspan='$numColumns' style='color:red'>NOTE: To fully implement a Persistent Promo the logic in the Admin to exclude members needs to be added and this note needs to be removed.</td></tr>";
764 $RGB = ($RGB ==
"odd" ?
"even" :
"odd");
768 <td colspan=
"<?php echo $numColumns; ?>" class=
"dtl">
769 <a href=
"<?php echo $self; ?>?act=1" target=
"_parent">Add Custom Content File</a>
771 <a href=
"<?php echo $infourl ?>/hcuadm/cuilist.prg" target=
"_parent">Credit Union List</a>
779 cu_header (
"Delete Custom Content File");
783 $query =
"select * from cucmsdocs 784 where docsid = '$docsid'";
785 $result = db_query($query, $link);
787 $docsRow = db_fetch_array($result);
788 $num_rows = db_num_rows($result);
790 echo
"<center><table width=\"40%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"dmsbg\"><tr><td>";
791 if ($num_rows > 0): ?>
792 <form action=
"<?php echo $self; ?>?act=5" method=
"post">
793 <input type=
"hidden" name=
"act" value=
"5">
794 <table width=
"100%" cellpadding=
"1" cellspacing=
"1" border=
"0">
796 <td
class=
"bar" align=
"center">
797 DELETE CUSTOM CONTENT FILE
798 <input type=
"hidden" name=
"docsid" value=
"<?php echo $docsRow['docsid']; ?>">
802 <td align=
"center" class=
"dtl">
803 Howdy Pardner, you have selected to
delete an Custom Content file.<br>
804 The file is named <b><?php echo htmlspecialchars(trim($docsRow[
'docsname'])); ?></b>.<br><br>
805 Please verify
this before deleting. After deleting
this file <br>you will need to reenter it
if you didn
't 810 <td nowrap class='dtl
'> 811 <table width="250" align='center
'><tr><td> 812 <?php remote_update_list(); ?> 817 <td align="right" class="hdr" nowrap> 818 <input type='submit
' name='btnSubmit
' value="Please delete this message"> 820 <input type="button" name="btnCancel" value="I don't want to
do this" onclick="document.location=
'<?php echo $self; ?>'"> 825 <table width="100%
" cellpadding="1
" cellspacing="1
" border="0
"> 827 <td class="bar
" align="center
"> 828 DELETE CUSTOM CONTENT FILE - Problem Encountered 832 <td class="dtl
" align="center
"> 833 Problem deleting the Custom Content File. <br> 834 It appears the file has already been deleted or never existed.<br> 835 Please return to the <a href="<?php echo $self; ?>
">menu</a> and try again. 841 echo "</td></tr></table>
"; 844 cu_header("CU Custom Content Skeleton File Edit
"); 845 // build the skeleton file name 846 $sql = "SELECT docsname, docstype FROM cucmsdocs WHERE docsid =
'$docsid'"; 847 $dbResult = db_query($sql, $link); 848 list($skelName, $docstype) = db_fetch_array($dbResult); 850 if ( strlen( $skelName ) > 0 ) { 851 $skelFile = "skel_
" . $skelName; 853 // insert the user security stuff in the url 854 $infourl = str_replace(" 857 if ($fp = fopen(
"$skeletonLocation/$language/$skelFile",
"r")) {
860 $contents .= fread($fp, 1024);
863 }
else if ( $language !=
"en_US" ) {
865 if ($fp = fopen(
"$skeletonLocation/en_US/$skelFile",
"r")) {
868 $contents .= fread($fp, 1024);
871 $userWarning =
"Skeleton file missing. Using English skeleton file as a starting point.";
879 $showcontents=htmlspecialchars($contents);
881 $textarea_TinyMCE =
"";
883 if ( $userWarning ) {
884 print
"<h4><span style='background-color:yellow;'>$userWarning</span></h4>";
887 if ( $docstype != 3 && $docstype != 4 ) {
888 print <<< set_TinyMCE
889 <script type=
"text/javascript" src=
"https://{$cloudfrontDomainName}/homecu/js/tinymce/{$tinyMceVersion}/tinymce.min.js"></script>
890 <script type=
"text/javascript">
893 doctype :
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
894 selector :
"textarea",
895 plugins : [
"autolink autosave link image lists charmap preview hr anchor spellchecker searchreplace wordcount visualchars code fullscreen insertdatetime nonbreaking save table contextmenu directionality emoticons textcolor paste textcolor"],
897 toolbar_items_size:
'small',
899 toolbar1 :
"save preview code | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
900 toolbar2 :
"cut copy paste pastetext pasteword | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image | insertdatetime inserttime | forecolor backcolor",
901 toolbar3 :
"table | hr removeformat visualaid | subscript superscript | charmap emoticons | spellchecker | visualchars nonbreaking | insertfile ",
902 relative_urls:
false,
903 remove_script_host :
false,
905 save_enablewhendirty :
true,
906 save_onsavecallback :
"savefile",
907 insertdatetime_formats: [
"%Y.%m.%d",
"%H:%M"],
910 valid_children :
"+body[style]" 912 function savefile () {
914 document.forms[0].submit();
921 <script language=
"javascript">
925 win = window.open(
"",
"htmlWin",
"scrollbars=1,menubar=1,status=1")
927 win.document.write(
"<P>")
928 win.document.write(document.preview.script_doc.value)
929 win.document.write(
"</P>")
935 print
"<h3>File $skelName is new and will be created at the Save.</h3>\n";
937 print
"<h3>Editing file $skelName.</h3>\n";
940 <form name=
"savefile" action=
"$self?act=44" method=
"post">
941 <input type=
"hidden" name=
"act" value=
"44">
942 <input type=
"hidden" name=
"docsid" value=
"$docsid">
943 <input type=
"hidden" name=
"language" value=
"$language">
944 <input type=
"submit" name=
"btnSubmit" value=
"Save my Changes">
945 <input type=
"button" name=
"btnCanc" value=
"Don't save my Changes" onclick=
"document.location='$self'">
947 <textarea name=
"script_doc" rows=50 cols=90>$showcontents</textarea>
953 <table align=center border=0 cellpadding=0 cellspacing=0 width="60%" class="dmsbg"><tr><td> 954 <table border=0 cellpadding=0 cellspacing=0 width="100%"> 957 An incorrect selection was made, please go back to the <a href="' . $self .
'">menu</a><br> 966 cu_header(
"CU Custom Content Skeleton File Save");
968 $sql =
"SELECT docsname FROM cucmsdocs WHERE docsid = '$docsid'";
969 $dbResult = db_query($sql, $link);
970 list($skelName) = db_fetch_array($dbResult);
971 if ( strlen( $skelName ) > 0 ) {
972 $skelFile =
"skel_" . $skelName;
975 $infourl = str_replace(
"//",
"//nobody:no1home@",$infourl);
976 $contents = $script_doc;
978 $save_as =
"$skeletonLocation/$language/$skelFile";
982 if (file_exists($save_as))
983 chmod($save_as, 0666);
987 if ($save_fp = fopen($save_as,
"w")) {
988 if (fwrite($save_fp, $contents)) {
993 chmod($save_as, 0644);
997 <table width=
"100%" border=0 cellpadding=0 cellspacing=1>
999 <td
class=
"bar" align=
"center">
1000 Skeleton File Save Confirmation
1006 if ($file_save ==
true) {
1007 print <<< print_html
1008 The skeleton file, $skelName was saved <b>successfully</b>.<br><br>
1009 Click here to
return to the <a href=
"$self">menu</a>.
1013 print <<< print_html
1014 An error occurred, the script was NOT saved successfully.<br>
1015 Please
try again before <a href=
"$self">screaming</a>.<br>
1016 (Your changes will be lost unless you use the
'Back' button.)
1019 print <<< print_html
1026 <table border=0 cellpadding=0 cellspacing=0 width="100%"> 1029 An incorrect selection was made, please go back to the <a href="' . $self .
'">menu</a><br> 1035 echo
"</td></tr></table>";
1038 cu_header(
"CU Custom Content Skeleton File Export To Default Content File");
1041 $sql =
"SELECT docsname FROM cucmsdocs WHERE docsid = '$docsid'";
1042 $dbResult = db_query($sql, $link);
1043 list($docName) = db_fetch_array($dbResult);
1046 <table border=0 cellpadding=0 cellspacing=0 width='100%' class='dmsbg'> 1047 <tr><td class='bar' style='text-align:center;'>Exporting $docName</td></tr>";
1050 $host = substr($_SERVER[
'SERVER_NAME'], 0,strpos($_SERVER[
'SERVER_NAME'],
"."));
1051 if ( $host ===
"www" ) {
1053 print
"<tr><td class='dtlc'>On MONITOR</td></tr>";
1055 for ( $i = 0; $i < count( $availableLanguages ); $i++ ) {
1057 $skelFile =
"skel_" . trim($docName);
1060 $hasSkeleton =
false;
1061 if ( file_exists(
"$skeletonLocation/{$availableLanguages[$i]["lang
"]}/$skelFile") ) {
1062 $hasSkeleton =
true;
1065 if ( $hasSkeleton ) {
1066 $message =
"Skeleton found - " . $availableLanguages[$i][
"display"];
1068 $message =
"Skeleton <span style='background-color:red;'>NOT</span> found - " . $availableLanguages[$i][
"display"];
1072 if ( $hasSkeleton ) {
1073 $source =
"$skeletonLocation/{$availableLanguages[$i]["lang
"]}/";
1074 $dest =
"$exportLocation/{$availableLanguages[$i]["lang
"]}/";
1077 $copyString =
"scp -i /home/ubuntu/.ssh/aws.key $source$skelFile ubuntu@int5.homecu.net:$dest";
1081 $resultMessage5 =
"<br><span style='background-color:red;'>NOTE:</span> For Batch server copy please run in terminal window: $copyString";
1084 $copyString =
"scp -i /home/ubuntu/.ssh/aws.key $source$skelFile ubuntu@int6.homecu.net:$dest";
1086 $resultMessage6 =
"<br><span style='background-color:red;'>NOTE:</span> For Live (www6) server copy please run in terminal window: $copyString";
1088 $copyString =
"scp -i /home/ubuntu/.ssh/aws.key $source$skelFile ubuntu@int3.homecu.net:$dest";
1090 $resultMessage6 .=
"<br><span style='background-color:red;'>NOTE:</span> For Live (www3) server copy please run in terminal window: $copyString";
1092 $resultMessage5 =
"No Copy Peformed";
1093 $resultMessage6 =
"";
1096 print
"<tr><td class='dtlc'>$message: $resultMessage5 $resultMessage6</td></tr>";
1100 print
"<tr><td class='dtlc'>On DEV</td></tr>";
1102 for ( $i = 0; $i < count( $availableLanguages ); $i++ ) {
1104 $skelFile =
"skel_" . trim($docName);
1107 $hasSkeleton =
false;
1108 if ( file_exists(
"$skeletonLocation/{$availableLanguages[$i]["lang
"]}/$skelFile") ) {
1109 $hasSkeleton =
true;
1112 if ( $hasSkeleton ) {
1113 $message =
"Skeleton found - " . $availableLanguages[$i][
"display"];
1115 $message =
"Skeleton <span style='background-color:red;'>NOT</span> found - " . $availableLanguages[$i][
"display"];
1119 if ( $hasSkeleton ) {
1120 $source =
"$skeletonLocation/{$availableLanguages[$i]["lang
"]}/";
1121 $dest =
"$exportLocation/{$availableLanguages[$i]["lang
"]}/";
1123 $result = copy( $source . $skelFile, $dest . $skelFile );
1125 $resultMessage = $result ?
"Success" :
"Failed";
1127 $resultMessage =
"No Copy Peformed";
1130 print
"<tr><td class='dtlc'>$message: $resultMessage</td></tr>";
1136 print
"<tr><td class='dtlc'>When ready, please go back to the <a href='$self'>menu</a></td></tr>";
1140 cu_header(
"Error Displaying Form");
1142 printError(
"Requested form not found!<br>Cancelling action.");