Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
content_type_edit_fns.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
19 
32 {
33 
34 
39  function __construct()
40  {
41  parent::__construct();
42 
43  unset($this->static_screens['permissions']);
44  unset($this->static_screens['workflow']);
45  unset($this->static_screens['metadataSchemas']);
46  unset($this->static_screens['metadata']);
47  unset($this->static_screens['linking']);
48  unset($this->static_screens['settings']);
49  unset($this->static_screens['history']);
50  unset($this->static_screens['tagging']);
51 
52  }//end constructor
53 
54 
65  function paint(Content_Type $asset, $editing=FALSE, $generating=FALSE)
66  {
67  $html = $asset->attr('html');
68  if ($generating) {
69  // escape dangerous content
70  require_once SQ_FUDGE_PATH.'/general/text.inc';
71  escape_php($html);
72  echo $html;
73  return TRUE;
74  }
75 
76  if ($editing) {
77  // We are in the edit interface, so print the interface and content
78  $this->_paintInterface($html, $asset);
79  } else {
80  // Just print content
81  echo $html;
82  }//end if
83 
84  }//end paint()
85 
86 
96  function _paintInterface($html, $asset)
97  {
98  $source = htmlspecialchars($html);
99  $source = preg_replace('/&lt;(div|br|p|table|tr|td|th|style|script|blockquote)/i', '<br />&lt;$1', $source);
100  $source = ltrim($source, '<br />');
101  $prefix = $asset->getPrefix();
102  $content_prefix = $prefix.'_'.get_class_lower($asset);
103  $path = sq_web_path('data').'/asset_types/bodycopy/images/icons/source_mode.png';
104  echo '<table border="0" cellspacing="0" cellpadding="0" class="bodytext">';
105  echo '<tr><td align="left" background="" id="'.$prefix.'_div_'.$asset->id.'" width="4%" style="border: 1px dashed #C0C0C0;">';
106  echo '<img align="absmiddle" src="'.$path.'" alt="View Source" title="View Source" width="16" height="16" style="cursor:pointer;" onclick="sq_toggle_double_div(\''.$content_prefix.'_html\', \''.$content_prefix.'_source\', \''.$content_prefix.'_control\', \'View Source\', \'View Preview\');if (this.alt == \'View Source\') { this.alt=\'View Preview\'; this.title=\'View Preview\'; } else { this.alt=\'View Source\'; this.title=\'View Source\' };" />';
107  echo '<span id="'.$content_prefix.'_control" style="display:none;">View Source</span>';
108  echo '</td></tr>';
109  echo '<tr><td style="border-left: 1px dashed #C0C0C0; border-right: 1px dashed #C0C0C0; border-bottom: 1px dashed #C0C0C0;" id="'.$content_prefix.'_cell">';
110  echo '<div id="'.$content_prefix.'_html" style="display: block;">';
111  echo $html;
112  echo '</div>';
113  echo '<div id="'.$content_prefix.'_source" style="display: none;">';
114  echo $source;
115  echo '</div>';
116  echo '</td></tr>';
117  echo '</table>';
118 
119  }//end _paintInterface()
120 
121 
131  function paintBackendIcons(Content_Type $asset, $prefix)
132  {
133 
134  }//end paintBackendIcons()
135 
136 
146  function paintBackendStatusIcons(Content_Type $asset, $prefix)
147  {
148 
149  }//end paintBackendStatusIcons()
150 
151 
152 }//end class
153 
154 ?>