Permalink
Browse files

seo panel

git-svn-id: http://www.pimcore.org/svn/pimcore/private/core/trunk@1101 1f8fe7d8-47f0-464c-8d0a-336f4953ab05
  • Loading branch information...
1 parent 9b90ae7 commit 837a2a4715d4352c728a2c9f0fc0beacd5ddc2c6 brusch committed Jan 19, 2012
View
@@ -7,7 +7,7 @@
* 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://www.pimcore.org/license dsf sdaf asdf asdf
+ * http://www.pimcore.org/license
*
* @copyright Copyright (c) 2009-2010 elements.at New Media Solutions GmbH (http://www.elements.at)
* @license http://www.pimcore.org/license New BSD License
@@ -1,3 +1,4 @@
+"document_seo_view","SEO Document View"
"clear_temp_files","Clear temporary files"
"reports","Reports"
"routes","Routes"
@@ -954,4 +954,57 @@ public function getVersionsAction() {
}
+
+
+ /**
+ * SEO PANEL
+ */
+ public function seopanelTreeRootAction() {
+ $root = Document::getById(1);
+ if ($root->isAllowed("list")) {
+
+ $nodeConfig = $this->getTreeNodeConfig($root);
+ $nodeConfig["title"] = $root->getTitle();
+ $nodeConfig["description"] = $root->getDescription();
+
+ $this->_helper->json($nodeConfig);
+ }
+
+ $this->_helper->json(array("success" => false, "message" => "missing_permission"));
+ }
+
+
+ public function seopanelTreeAction() {
+
+ $document = Document::getById($this->_getParam("node"));
+
+ $documents = array();
+ if ($document->hasChilds()) {
+
+ $list = new Document_List();
+ $list->setCondition("parentId = ?", $document->getId());
+ $list->setOrderKey("index");
+ $list->setOrder("asc");
+
+ $childsList = $list->load();
+
+ foreach ($childsList as $childDocument) {
+ // only display document if listing is allowed for the current user
+ if ($childDocument->isAllowed("list")) {
+ $nodeConfig = $this->getTreeNodeConfig($childDocument);
+
+ if(method_exists($childDocument, "getTitle") && method_exists($childDocument, "getDescription")) {
+ $nodeConfig["title"] = $childDocument->getTitle();
+ $nodeConfig["description"] = $childDocument->getDescription();
+ }
+
+ $documents[] = $nodeConfig;
+ }
+ }
+ }
+
+ $this->_helper->json($documents);
+ }
+
+
}
@@ -49,6 +49,7 @@
"/pimcore/static/js/lib/ext-plugins/ux/statusbar/css/statusbar.css",
"/pimcore/static/js/lib/ext-plugins/ux/css/Portal.css",
"/pimcore/static/js/lib/ext-plugins/ux/css/MultiSelect.css",
+ "/pimcore/static/js/lib/ext-plugins/ux/treegrid/treegrid.css",
"/pimcore/static/js/lib/ext-plugins/ux/css/ColumnHeaderGroup.css",
"/pimcore/static/js/lib/ext-plugins/ux/gridfilters/css/GridFilters.css",
"/pimcore/static/js/lib/ext-plugins/ux/gridfilters/css/RangeMenu.css",
@@ -223,22 +224,22 @@
"pimcore/document/properties.js",
"pimcore/document/document.js",
"pimcore/document/page_snippet.js",
- //"pimcore/document/page_email.js", //ckogler
"pimcore/document/edit.js",
- "pimcore/document/editemail.js", //ckogler
+ "pimcore/document/editemail.js",
"pimcore/document/versions.js",
"pimcore/document/pages/settings.js",
"pimcore/document/pages/preview.js",
"pimcore/document/snippets/settings.js",
- "pimcore/document/emails/settings.js", //ckogler
- "pimcore/document/emails/logs.js", //ckogler
+ "pimcore/document/emails/settings.js",
+ "pimcore/document/emails/logs.js",
"pimcore/document/link.js",
"pimcore/document/hardlink.js",
"pimcore/document/folder.js",
"pimcore/document/tree.js",
"pimcore/document/snippet.js",
- "pimcore/document/email.js", //ckogler
+ "pimcore/document/email.js",
"pimcore/document/page.js",
+ "pimcore/document/seopanel.js",
// assets
"pimcore/asset/asset.js",
@@ -1088,4 +1088,8 @@
.pimcore_icon_role_add {
background: url(/pimcore/static/img/icon/group_add.png) left center no-repeat !important;
+}
+
+.pimcore_icon_seo {
+ background: url(/pimcore/static/img/icon/report_edit.png) left center no-repeat !important;
}
@@ -0,0 +1,182 @@
+/**
+ * Pimcore
+ *
+ * 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://www.pimcore.org/license
+ *
+ * @copyright Copyright (c) 2009-2010 elements.at New Media Solutions GmbH (http://www.elements.at)
+ * @license http://www.pimcore.org/license New BSD License
+ */
+
+pimcore.registerNS("pimcore.document.seopanel");
+pimcore.document.seopanel = Class.create({
+
+ initialize: function () {
+ this.getTabPanel();
+ },
+
+
+ activate: function () {
+ var tabPanel = Ext.getCmp("pimcore_panel_tabs");
+ tabPanel.activate("pimcore_document_seopanel");
+ },
+
+ getTabPanel: function () {
+
+ if (!this.panel) {
+ this.panel = new Ext.Panel({
+ id: "pimcore_document_seopanel",
+ title: t("document_seo_view"),
+ iconCls: "pimcore_icon_seo",
+ border: false,
+ layout: "fit",
+ closable:true,
+ items: []
+ });
+
+ var tabPanel = Ext.getCmp("pimcore_panel_tabs");
+ tabPanel.add(this.panel);
+ tabPanel.activate("pimcore_document_seopanel");
+
+
+ this.panel.on("destroy", function () {
+ pimcore.globalmanager.remove("document_seopanel");
+ }.bind(this));
+
+ pimcore.layout.refresh();
+
+ Ext.Ajax.request({
+ url: "/admin/document/seopanel-tree-root",
+ success: function (response) {
+ var res = Ext.decode(response.responseText);
+ if(res["id"]) {
+ this.getTreeGrid(res);
+ }
+ }.bind(this)
+ });
+ }
+
+ return this.panel;
+ },
+
+ getTreeGrid: function (rootNodeConfig) {
+
+
+ rootNodeConfig.nodeType = "async";
+ rootNodeConfig.text = "home";
+ rootNodeConfig.iconCls = "pimcore_icon_home";
+ rootNodeConfig.expanded = true;
+ rootNodeConfig.attributes = {};
+
+ var columns = [{
+ header: t("name"),
+ dataIndex: 'text',
+ width: 300
+ },{
+ header: t("title"),
+ dataIndex: 'title',
+ width: 230
+ },{
+ header: t("description"),
+ dataIndex: 'description',
+ width: 400
+ }];
+
+ var tree = new Ext.ux.tree.TreeGrid({
+ columns: columns,
+ useArrows:true,
+ enableSort: false,
+ animate:true,
+ rootVisible: true,
+ root: rootNodeConfig,
+ border: false,
+ loader: new Ext.ux.tree.TreeGridLoader({
+ dataUrl: "/admin/document/seopanel-tree",
+ requestMethod: "GET",
+ baseAttrs: {
+ reference: this,
+ allowDrop: true,
+ allowChildren: true,
+ isTarget: true,
+ nodeType: "async",
+ listeners: {
+ "click": this.openEditPanel.bind(this)
+ }
+ }
+ })
+ });
+
+ this.panel.add(tree);
+ this.panel.doLayout();
+ },
+
+ openEditPanel: function (node) {
+
+ if(node.attributes.type != "page") {
+ return;
+ }
+
+ if(this.editWindow) {
+ delete this.editWindow;
+ }
+ if(this.formPanel) {
+ delete this.formPanel;
+ }
+
+ this.formPanel = new Ext.form.FormPanel({
+ bodyStyle: "padding:10px;",
+ items: [{
+ xtype: "textfield",
+ fieldLabel: t("title"),
+ name: "title",
+ value: node.attributes.title,
+ width: 350
+ }, {
+ xtype: "textarea",
+ fieldLabel: t("description"),
+ name: "description",
+ value: node.attributes.description,
+ width: 350
+ },{
+ xtype: "hidden",
+ name: "id",
+ value: node.attributes.id
+ }]
+ });
+
+ this.editWindow = new Ext.Window({
+ modal: true,
+ width: 500,
+ height: 200,
+ closable: true,
+ items: [this.formPanel],
+ buttons: [{
+ text: t("save"),
+ iconCls: "pimcore_icon_accept",
+ handler: this.save.bind(this, node)
+ }]
+ });
+
+ this.editWindow.show();
+ },
+
+ save: function (node) {
+
+ var values = this.formPanel.getForm().getFieldValues();
+ this.editWindow.close();
+
+ Ext.Ajax.request({
+ url: "/admin/document/update/",
+ method: "post",
+ params: values,
+ success: function (node) {
+ node.parentNode.reload();
+ }.bind(this, node)
+ });
+ }
+
+});
@@ -146,15 +146,6 @@ pimcore.layout.toolbar = Class.create({
});
}
- // admin translations only for admins
- if(user.admin) {
- extrasItems.push({
- text: t("translations_admin"),
- iconCls: "pimcore_icon_translations",
- handler: this.editTranslationsSpecific
- });
- }
-
if (user.isAllowed("system_settings")) {
extrasItems.push({
text: t("systemlog"),
@@ -171,6 +162,14 @@ pimcore.layout.toolbar = Class.create({
});
}
+ if (user.isAllowed("documents")) {
+ extrasItems.push({
+ text: t("document_seo_view"),
+ iconCls: "pimcore_icon_seo",
+ handler: this.showDocumentSeo
+ });
+ }
+
if (user.isAllowed("reports")) {
extrasItems.push({
text: t("reports_and_marketing") + " (beta)",
@@ -281,7 +280,6 @@ pimcore.layout.toolbar = Class.create({
});
}
-
if (user.isAllowed("objects")) {
var objectMenu = {
@@ -364,6 +362,15 @@ pimcore.layout.toolbar = Class.create({
settingsItems.push(cacheMenu);
}
+ // admin translations only for admins
+ if(user.admin) {
+ settingsItems.push({
+ text: t("translations_admin"),
+ iconCls: "pimcore_icon_translations",
+ handler: this.editTranslationsSpecific
+ });
+ }
+
if (user.isAllowed("reports") && user.isAllowed("system_settings")) {
settingsItems.push({
text: t("reports_and_marketing") + " (beta)",
@@ -702,6 +709,15 @@ pimcore.layout.toolbar = Class.create({
}
},
+ showDocumentSeo: function () {
+ try {
+ pimcore.globalmanager.get("document_seopanel").activate();
+ }
+ catch (e) {
+ pimcore.globalmanager.add("document_seopanel", new pimcore.document.seopanel());
+ }
+ },
+
clearCache: function () {
Ext.Msg.confirm(t('warning'), t('system_performance_stability_warning'), function(btn){
if (btn == 'yes'){

0 comments on commit 837a2a4

Please sign in to comment.