Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
code_for_tagtype_frontendediting.code.php
1 ## ALWAYS CHANGE THE CMSVERSION WITH A NEW UPDATE OF THE CMS
2 ##
3 #if($cms.rendermode.publish)##
4 <?php
5 
6 $page['id'] = '<node page.id>';
7 $page['language'] = '<node page.language.code>';
8 $page['template'] = '<node page.template.id>';
9 
10 // only if user is logged in, frontend editing is possible
11 if (Yii::app()->user->email != '') {
12 
13 ?>
14 
15 
16 <script type="text/javascript" src="<node feedit>"></script>
17 <?php if (isset( $_GET['edit']) || isset( $_GET['new']) ) {?>
18 
19 <style>
20 .frontendpanel {
21  left: 0px;
22  position: absolute;
23  text-align:left;
24 }
25 body {
26  padding-top:0px !important;
27 }
28 </style>
29 
30 #set($cms_version = "<node cmsversion>")##
31 
32 <script type="text/javascript">
33 
34 /**$(document).ready(function() {**/
35 
36 Aloha = {};
37 Aloha.settings = {
38  "ribbon" : false,
39  "contentHandler" : {
40  "insertHtml" : [ "gcn-tagcopy", "word", "generic", "block", "formatless" ],
41  "getContents" : [ "blockelement", "basic" ],
42  "initEditable" : [ "blockelement" ]
43  },
44  "plugins" : {
45  "pagelanguage" : "<node page.language.code>",
46  "gcn": {
47  "buildRootTimestamp" : "$!{cms_version}",
48  "webappPrefix" : "/gcnproxy/CNPortletapp/",
49  "stag_prefix" : "/gcnproxy/.Node/",
50  /**"id": this.id, **/
51  "id" : "<?php if ( isset ( $_GET['pageid'] ) && isset( $_GET['edit'] ) ) echo $_GET['pageid']; else echo $page['id']; ?>", //set pageid here
52  "links": "backend",
53  /**"links": "frontend",**/
54  /**
55  "nodeFolderId": config.nodeFolderId,
56  "nodeId": config.nodeId,
57  "folderId": this.userPanel.folderid,
58  **/
59  /**"folderId": "$cms.folder.id", **/
60  "nodeFolderId" : "$cms.node.folder.id",
61  "nodeId" : "$cms.node.id",
62  "editables" : {
63  ".title,.subtitle,.teaser" : {
64  "tagtypeWhitelist" : []
65  }
66  }
67  },
68  "block": {
69  "dragdrop": "1",
70  "config": {
71  "toggleDragdropGlobal": "true"
72  },
73  "dropzones": ['.dropzone > div']
74  },
75  "table" : {
76  "config" : ["table"],
77  "tableConfig" : [
78  {
79  "name" : "variation1"
80  },
81  {
82  "name" : "variation2"
83  }
84  ]
85  },
86  "formatlesspaste": {
87  "editables": {
88  ".title": {
89  "strippedElements": ["a", "em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "ruby", "rt", "rp", "bdi", "bdo", "ins", "del"],
90  "button": "False",
91  "formatlessPasteOption": "1"
92  },
93  ".subtitle": {
94  "strippedElements": ["a", "em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "ruby", "rt", "rp", "bdi", "bdo", "ins", "del"],
95  "button": "False",
96  "formatlessPasteOption": "1"
97  },
98  ".teaser": {
99  "strippedElements": ["a", "em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "ruby", "rt", "rp", "bdi", "bdo", "ins", "del"],
100  "button": "False",
101  "formatlessPasteOption": "1"
102  },
103  },
104  },
105  },
106  "com.gentics.aloha.plugins.CropNResize": {
107  "selector": "img[data-GENTICS-aloha-repository=com.gentics.aloha.GCN.Image]"
108  },
109  "i18n": {
110  "current": "<node page.language.code>"
111  },
112  "locale": "<node page.language.code>",
113  "toolbar": {
114  "tabs": [{
115  "label": "tab.format.label"
116  }, {
117  "label": "tab.insert.label",
118  "components": [
119  ["gcnArena"]
120  ]
121  }, {
122  "label": "tab.link.label",
123  "components": ["editLink", "removeLink", "linkBrowser", "gcnLinkBrowser", "gcnFileUpload"]
124  }]
125  }
126 
127 };
128 
129 var sid = '<?php $this->widget('cmsuserauthentication.widgets.CmsuserauthenticationWidget'); ?>';
130 if (sid==='0' || sid==='') {
131  alert("Error: Authentication on CMS failed");
132 } else {
133  Aloha.settings.plugins.gcn.sid = sid;
134 }
135 
136 /** }); **/
137 
138 </script>
139 
140 <!-- Load Aloha Editor -->
141 <script src="/gcnproxy/CNPortletapp/$!{cms_version}/alohaeditor/lib/aloha.js" data-aloha-plugins="common/ui,
142 common/block,
143 extra/ribbon,
144 common/format,
145 common/list,
146 common/link,
147 common/table,
148 common/paste,
149 common/contenthandler,
150 common/commands,
151 gcn/gcn-linkbrowser,
152 gcn/gcn,
153 common/characterpicker,
154 common/horizontalruler"></script>
155 
156 <!-- Load Aloha Editor CSS -->
157 <link rel="stylesheet" href="/gcnproxy/CNPortletapp/$!{cms_version}/alohaeditor/css/aloha.css"></script>
158 
159 
160 <script type="text/javascript">
161 (function (window) {
162  // use Aloha Editor's internal jQuery & expose it
163  var Aloha = window.Aloha;
164  //window.$ = window.jQuery = window.Aloha.jQuery;
165 
166  Aloha.ready(function(){
167  GCN = window.GCN;
168  GCN.settings.BACKEND_PATH="/gcnproxy/CNPortletapp";
169 
170  //GCN.login('node', 'node', function(success, data) {
171  if (sid) {
172  GCN.setSid(sid);
173 
174  <?php if(isset($_GET['edit'])){ ?>
175  <?php if(isset($_GET['pageid'])){ ?>
176  gtx_feEditor.init({language: '<?php if ( isset( $page['language'] ) ) echo $page['language']; else echo 'en'; ?>', id: '<?php echo $_GET['pageid']; ?>'});
177  <?php } else {?>
178  gtx_feEditor.init({language: '<?php if ( isset( $page['language'] ) ) echo $page['language']; else echo 'en'; ?>', id: '<?php if ( isset( $page['id'] ) ) echo $page['id']; else echo 'unknown'; ?>'});
179  <?php } ?>
180 
181  <?php } else{ ?>
182  gtx_feEditor.createPage({language: '<?php if ( isset( $page['language'] ) ) echo $page['language']; else echo 'en'; ?>', id: '<?php if ( isset( $page['id'] ) ) echo $page['id']; else echo 'unknown'; ?>'});
183  <?php } ?>
184  }
185  //});
186  });
187 }(window));
188 </script>
189 
190 <style>
191 .aloha-editable {
192 min-height: 1.2em;
193 outline: #FFD600 dotted 3px;
194 }
195 </style>
196 
197 <?php } } ?>
198 #end##