Parent Directory
|
Revision Log
|
Revision Graph
remove old code.
| 1 | <?php |
| 2 | // $Id: contaxe.module,v 1.13 2008/02/27 18:51:55 salgar Exp $ |
| 3 | |
| 4 | /* |
| 5 | http://drupal.org/project/jquery_update |
| 6 | http://drupal.org/project/jquery_interface |
| 7 | http://drupal.org/project/interface_sortable |
| 8 | |
| 9 | */ |
| 10 | |
| 11 | define('CONTAXE_MODE_NORMAL', 1); |
| 12 | define('CONTAXE_MODE_DEMO', 2); |
| 13 | define('CONTAXE_MODE_NOTHING', 3); |
| 14 | |
| 15 | define('CONTAXE_MAX_BLOCKS', 8); |
| 16 | define('CONTAXE_BLOCK', 'contaxe_block'); |
| 17 | |
| 18 | define('CONTAXE_CHANNEL_ID', 'contaxe_channel_id'); |
| 19 | define('CONTAXE_REGULAR_VISITS', 'contaxe_regular_visits'); |
| 20 | define('CONTAXE_REGULAR_DAYS', 'contaxe_regular_days'); |
| 21 | define('CONTAXE_VISIBILITY_ADMIN', 'contaxe_visibility_admin'); |
| 22 | define('CONTAXE_VISIBILITY_USER', 'contaxe_visibility_user'); |
| 23 | define('CONTAXE_VISIBILITY_VISITOR', 'contaxe_visibility_visitor'); |
| 24 | |
| 25 | define('CONTAXE_REVENUE_ENABLE', 'contaxe_revenue_enable'); |
| 26 | define('CONTAXE_REVENUE_PROFILE_FIELD', 'contaxe_revenue_profile_field'); |
| 27 | define('CONTAXE_PERCENTAGE_AUTHOR', 'contaxe_percentage_author'); |
| 28 | define('CONTAXE_PERCENTAGE_REFERRAL', 'contaxe_percentage_referral'); |
| 29 | |
| 30 | define('CONTAXE_REVENUE_CHANNEL_SITE', 0); |
| 31 | |
| 32 | |
| 33 | define('CONTAXE_HIGHLIGHTER_ENABLE', 'contaxe_highlighter_enable'); |
| 34 | define('CONTAXE_HIGHLIGHTER_CHANNEL_ID', 'contaxe_highlighter_channel_id'); |
| 35 | define('CONTAXE_HIGHLIGHTER_DESIGN_ID', 'contaxe_highlighter_design_id'); |
| 36 | define('CONTAXE_HIGHLIGHTER_WORDS', 'contaxe_highlighter_words'); |
| 37 | define('CONTAXE_HIGHLIGHTER_REPEAT', 'contaxe_highlighter_repeat'); |
| 38 | define('CONTAXE_HIGHLIGHTER_DELAY', 'contaxe_highlighter_delay'); |
| 39 | define('CONTAXE_HIGHLIGHTER_BIGFONT', 'contaxe_highlighter_bigfont'); |
| 40 | define('CONTAXE_HIGHLIGHTER_ACTIVE_RULES', 'activerules'); |
| 41 | define('CONTAXE_HIGHLIGHTER_INACTIVE_RULES', 'inactiverules'); |
| 42 | |
| 43 | define('CONTAXE_ISA_ENABLE', 'contaxe_isa_enable'); |
| 44 | define('CONTAXE_ISA_CHANNEL_ID', 'contaxe_isa_channel_id'); |
| 45 | define('CONTAXE_ISA_DESIGN_ID', 'contaxe_isa_design_id'); |
| 46 | define('CONTAXE_ISA_TYPE', 'contaxe_isa_type'); |
| 47 | define('CONTAXE', 'CONTAXE'); |
| 48 | |
| 49 | define('CONTAXE_INJECTOR_NODETYPE', 'contaxe_injector_nodetype'); |
| 50 | define('CONTAXE_INJECTOR_DEFAULT_BODY_TEMPLATE', "<div style=\"float: left; margin: 0 1em .25em 0;\">\n [contaxe:1]\n</div>\n%body\n<br style=\"clear: left;\"/>\n[contaxe:2]"); |
| 51 | define('CONTAXE_INJECTOR_DEFAULT_LIST_TEMPLATE', "%teaser\n<div>\n [contaxe:2]\n</div>\n"); |
| 52 | |
| 53 | $GLOBALS['_CONTAXE_RULES'] = array( |
| 54 | 'fromsearchengine', |
| 55 | 'regularvisitor', |
| 56 | 'date', |
| 57 | 'home', |
| 58 | 'loggedin', |
| 59 | 'olderthan', |
| 60 | 'fallback', |
| 61 | 'any', |
| 62 | ); |
| 63 | |
| 64 | $GLOBALS['_CONTAXE_BANNER_OPTIMIZATION'] = array( |
| 65 | 0 => 'Kontextsensitiv, standard', |
| 66 | 1 => 'Kontextsensitiv, oft gesehene Werbemittel ausblenden', |
| 67 | 2 => 'Kontextsensitiv, oft gesehene Kampagnen ausblenden', |
| 68 | 3 => 'Kontextsensitive und zufällige Werbung abwechselnd', |
| 69 | 4 => 'Nur zufällige Werbung' |
| 70 | ); |
| 71 | |
| 72 | $GLOBALS['_CONTAXE_ADFORMATS'] = array( |
| 73 | 1 => array( 'desc' => 'Fullbanner', 'width' => '468', 'height' => '60', 'adtype' => 'img'), |
| 74 | 2 => array( 'desc' => 'Leaderboard', 'width' => '728', 'height' => '90', 'adtype' => 'img'), |
| 75 | 3 => array( 'desc' => 'Halfbanner', 'width' => '234', 'height' => '60', 'adtype' => 'img'), |
| 76 | 4 => array( 'desc' => 'Vertical Banner', 'width' => '120', 'height' => '240', 'adtype' => 'img'), |
| 77 | 5 => array( 'desc' => 'Rectangle', 'width' => '180', 'height' => '150', 'adtype' => 'img'), |
| 78 | 6 => array( 'desc' => 'Medium Rectangle', 'width' => '300', 'height' => '250', 'adtype' => 'img'), |
| 79 | 7 => array( 'desc' => 'Large Rectangle', 'width' => '336', 'height' => '280', 'adtype' => 'img'), |
| 80 | 8 => array( 'desc' => 'Vertical Rectangle', 'width' => '240', 'height' => '400', 'adtype' => 'img'), |
| 81 | 9 => array( 'desc' => 'Skyscraper', 'width' => '120', 'height' => '600', 'adtype' => 'img'), |
| 82 | 10 => array( 'desc' => 'Wide Skyscraper', 'width' => '160', 'height' => '600', 'adtype' => 'img'), |
| 83 | 11 => array( 'desc' => 'Button 1', 'width' => '120', 'height' => '90', 'adtype' => 'img'), |
| 84 | 12 => array( 'desc' => 'Button 2', 'width' => '120', 'height' => '60', 'adtype' => 'img'), |
| 85 | 13 => array( 'desc' => 'Micro Bar', 'width' => '88', 'height' => '31', 'adtype' => 'img'), |
| 86 | 14 => array( 'desc' => 'Micro Button', 'width' => '80', 'height' => '15', 'adtype' => 'img'), |
| 87 | 15 => array( 'desc' => 'Medium Rectangle (2x2)', 'width' => '300', 'height' => '250', 'adtype' => 'txt'), |
| 88 | 16 => array( 'desc' => 'Vertical Banner (2x1)', 'width' => '120', 'height' => '240', 'adtype' => 'txt'), |
| 89 | 17 => array( 'desc' => 'Wide Skyscraper (4x1)', 'width' => '160', 'height' => '600', 'adtype' => 'imgtxt'), |
| 90 | 18 => array( 'desc' => 'Fullbanner (1x1)', 'width' => '468', 'height' => '60', 'adtype' => 'txt'), |
| 91 | 19 => array( 'desc' => 'Fullbanner (1x1)', 'width' => '468', 'height' => '60', 'adtype' => 'imgtxt'), |
| 92 | /* |
| 93 | 20 => array( 'desc' => 'Standard Highlighter (1x1)', 'width' => '200', 'height' => '250', 'adtype' => 'txt'), |
| 94 | */ |
| 95 | 21 => array( 'desc' => 'Fullbanner', 'width' => '468', 'height' => '60', 'adtype' => 'flash'), |
| 96 | 22 => array( 'desc' => 'Leaderbord', 'width' => '728', 'height' => '90', 'adtype' => 'flash'), |
| 97 | 23 => array( 'desc' => 'Halfbanner', 'width' => '234', 'height' => '60', 'adtype' => 'flash'), |
| 98 | 24 => array( 'desc' => 'Vertical Banner', 'width' => '120', 'height' => '240', 'adtype' => 'flash'), |
| 99 | 25 => array( 'desc' => 'Rectangle', 'width' => '180', 'height' => '150', 'adtype' => 'flash'), |
| 100 | 26 => array( 'desc' => 'Medium Rectangle', 'width' => '300', 'height' => '250', 'adtype' => 'flash'), |
| 101 | 27 => array( 'desc' => 'Large Rectangle', 'width' => '336', 'height' => '280', 'adtype' => 'flash'), |
| 102 | 28 => array( 'desc' => 'Vertical Rectangle', 'width' => '240', 'height' => '400', 'adtype' => 'flash'), |
| 103 | 29 => array( 'desc' => 'Skyscraper', 'width' => '120', 'height' => '600', 'adtype' => 'flash'), |
| 104 | 30 => array( 'desc' => 'Wide Skyscraper', 'width' => '160', 'height' => '600', 'adtype' => 'flash'), |
| 105 | 31 => array( 'desc' => 'Leaderboard (1x3)', 'width' => '728', 'height' => '90', 'adtype' => 'txt'), |
| 106 | 32 => array( 'desc' => 'Rectangle (1x1)', 'width' => '180', 'height' => '150', 'adtype' => 'txt'), |
| 107 | 33 => array( 'desc' => 'Halfbanner (1x1)', 'width' => '234', 'height' => '60', 'adtype' => 'txt'), |
| 108 | 34 => array( 'desc' => 'Medium Rectangle (3x1)', 'width' => '300', 'height' => '250', 'adtype' => 'txt'), |
| 109 | 35 => array( 'desc' => 'Large Rectangle (3x2)', 'width' => '336', 'height' => '280', 'adtype' => 'txt'), |
| 110 | 36 => array( 'desc' => 'Skyscraper (5x1)', 'width' => '120', 'height' => '600', 'adtype' => 'txt'), |
| 111 | 37 => array( 'desc' => 'Wide Skyscraper (6x1)', 'width' => '160', 'height' => '600', 'adtype' => 'txt'), |
| 112 | 38 => array( 'desc' => 'Vertical Rectangle (3x2)', 'width' => '240', 'height' => '400', 'adtype' => 'txt'), |
| 113 | 39 => array( 'desc' => 'Leaderboard (1x2)', 'width' => '728', 'height' => '90', 'adtype' => 'imgtxt'), |
| 114 | 41 => array( 'desc' => 'Vertical Banner (1x1)', 'width' => '120', 'height' => '240', 'adtype' => 'imgtxt'), |
| 115 | 42 => array( 'desc' => 'Rectangle (1x1)', 'width' => '180', 'height' => '150', 'adtype' => 'imgtxt'), |
| 116 | 43 => array( 'desc' => 'Medium Rectangle (3x1)', 'width' => '300', 'height' => '250', 'adtype' => 'imgtxt'), |
| 117 | 44 => array( 'desc' => 'Large Rectangle (3x1)', 'width' => '336', 'height' => '280', 'adtype' => 'imgtxt'), |
| 118 | 45 => array( 'desc' => 'Skyscraper (3x1)', 'width' => '120', 'height' => '600', 'adtype' => 'imgtxt'), |
| 119 | 46 => array( 'desc' => 'Vertical Rectangle (2x2)', 'width' => '240', 'height' => '400', 'adtype' => 'imgtxt'), |
| 120 | 49 => array( 'desc' => 'Vertical Rectangle (5x1)', 'width' => '240', 'height' => '400', 'adtype' => 'txt'), |
| 121 | 51 => array( 'desc' => 'Large Rectangle (4x1)', 'width' => '336', 'height' => '280', 'adtype' => 'txt'), |
| 122 | 52 => array( 'desc' => 'Half Wide Skyscraper (3x1)', 'width' => '160', 'height' => '300', 'adtype' => 'txt'), |
| 123 | 53 => array( 'desc' => 'Half Wide Skyscraper (2x1)', 'width' => '160', 'height' => '300', 'adtype' => 'imgtxt'), |
| 124 | /* |
| 125 | 54 => array( 'desc' => 'Standard Highlighter, große Schrift (1x1)', 'width' => '200', 'height' => '250', 'adtype' => 'txt'), |
| 126 | 55 => array( 'desc' => 'Intelligent Search Ad (1 Anzeige)', 'width' => '200', 'height' => '250', 'adtype' => 'txt'), |
| 127 | 56 => array( 'desc' => 'Intelligent Search Ad (2 Anzeigen)', 'width' => '200', 'height' => '250', 'adtype' => 'txt'), |
| 128 | 57 => array( 'desc' => 'Intelligent Search Ad (5 Titel)', 'width' => '200', 'height' => '250', 'adtype' => 'txt'), |
| 129 | 58 => array( 'desc' => 'Intelligent Search Ad (10 Titel)', 'width' => '200', 'height' => '250', 'adtype' => 'txt') |
| 130 | */ |
| 131 | ); |
| 132 | |
| 133 | $GLOBALS['_CONTAXE_ADTYPE2TEXT'] = array( |
| 134 | 'txt' => 'Text', |
| 135 | 'img' => 'Grafik', |
| 136 | 'imgtxt' => 'Text mit Bild', |
| 137 | 'flash' => 'Flash', |
| 138 | ); |
| 139 | |
| 140 | foreach ($GLOBALS['_CONTAXE_ADFORMATS'] as $key => $value) { |
| 141 | $GLOBALS['_CONTAXE_ADFORMATS'][$key]['title'] = $GLOBALS['_CONTAXE_ADTYPE2TEXT'][$value['adtype']] |
| 142 | . ': ' . $value['desc'] |
| 143 | . ' (' . $value['width'] |
| 144 | . 'x' . $value['height'] . ' px)' |
| 145 | ; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Display help and module information |
| 150 | * @param section which section of the site we're displaying help |
| 151 | * @return help text for section |
| 152 | */ |
| 153 | function contaxe_help($section='') { |
| 154 | $output = ''; |
| 155 | |
| 156 | switch ($section) { |
| 157 | case 'admin/settings/contaxe': |
| 158 | $output = 'Dieses Modul erlaubt es Contaxe-Werbung in Drupal einzubinden. Durch komplexe |
| 159 | Regeln kann definiert werden, wann ein Werbemittel sichtbar ist. Ausserdem können die Einnahmen |
| 160 | mittels Revenue Sharing unter mehreren Autoren aufgeteilt werden.'; |
| 161 | break; |
| 162 | case 'admin/settings/contaxe/isa': |
| 163 | $output = 'Das <em>Intelligent Search Ad</em> ist ein Werbemittel welches mit dem Suchfeld |
| 164 | Ihrer Website verbunden ist. Sobald Suchbegriffe eingegeben werden, erscheint dazu passende |
| 165 | Werbung in einem kleinen Fenster unterhalb des Eingabefelds.'; |
| 166 | break; |
| 167 | case 'admin/help#contaxe': |
| 168 | $output = ' |
| 169 | <p>Dieses Modul erlaubt es Contaxe-Werbung in Drupal einzubinden. Durch komplexe Regeln |
| 170 | kann definiert werden, wann ein Werbemittel sichtbar ist. Ausserdem können die Einnahmen |
| 171 | mittels Revenue Sharing unter mehreren Autoren aufgeteilt werden.</p> |
| 172 | |
| 173 | <h2>Voraussetzungen</h2> |
| 174 | <p>Sie müssen als Affiliate oder Agentur bei <a href="http://www.contaxe.com">Contaxe</a> |
| 175 | angemeldet sein um dieses Modul nutzen zu können.</p> |
| 176 | |
| 177 | <h2>Optionale Module</h2> |
| 178 | <ul> |
| 179 | <li><strong>Search</strong>: Zur Integration des Intelligent Search Ads.</li> |
| 180 | <li><strong>Profile</strong>: Um Revenue Sharing zu betreiben.</li> |
| 181 | <li><strong><a href="http://drupal.org/project/referral">Referral</a></strong>: |
| 182 | Um beim Revenue Sharing auch die Referrals zu beteiligen. |
| 183 | </li> |
| 184 | <li><strong><a href="http://drupal.org/project/interface_sortable">jQuery Interface Sortable</a></strong>: |
| 185 | Für das Regelsystem.<br/> |
| 186 | <small>Für das Modul <em>jQuery Interface Sortable</em> werden zusätzlich die Module |
| 187 | <em><a href="http://drupal.org/project/jquery_update">jQuery Update</a></em> sowie |
| 188 | <em><a href="http://drupal.org/project/jquery_interface">jQuery Interface</a></em> benötigt.</small> |
| 189 | </li> |
| 190 | </ul> |
| 191 | |
| 192 | <h2>Unterstützte Werbeformate</h2> |
| 193 | <p>Neben dem <em>Intelligent Search Ad</em> und dem <em>Text-Highlighting</em> werden sämtliche Bannerformate |
| 194 | die Contaxe anbietet unterstützt. Einen Überblick über die verschiedenen Werbemittel erhalten |
| 195 | Sie in der <a href="http://www.contaxe.com/de/texte/werbemittelvorschau/">Werbemittelvorschau</a>. |
| 196 | </p> |
| 197 | |
| 198 | <h2>Contaxe-Banner einbinden</h2> |
| 199 | <!-- <p>Es gibt mehrere Wege um Contaxe-Werbebanner einzubinden. Diese sind im Folgenden zusammengefasst.</p> --> |
| 200 | |
| 201 | <div class="messages warning">Die folgenden Ausführungen beziehen sich nicht auf die Werbeformate <em>Intelligent |
| 202 | Search Ad</em> sowie <em>Text-Highlighting</em>. Diese Formate werden automatisch eingebunden, |
| 203 | sobald sie im Verwaltungsbereich des Contaxe-Moduls aktiviert werden.</div> |
| 204 | |
| 205 | <h3>Contaxe-Blöcke</h3> |
| 206 | <p>Am schnellsten lassen sich Contaxe-Banner mit Hilfe der vorgegebenen Blöcke einbinden. |
| 207 | Besuchen Sie dazu die <a href="' . url('admin/build/block') . '">Block-Verwaltung</a>, |
| 208 | konfigurieren Sie einen der Contaxe-Blöcke und wählen Sie einen Banner. Anschließend müssen Sie |
| 209 | den Block noch aktivieren indem Sie eine Region dafür auswählen und die Blöcke speichern.</p> |
| 210 | |
| 211 | <h3 id="contaxe-tags">Contaxe-Tags</h3> |
| 212 | <p>Tags erlauben die Platzierung von Bannern in Inhalten. Inhalt meint hier alles was |
| 213 | durch Drupals Filtersystem geleitet wird. Text im Footer, der Slogan u.a. werden für gewöhnlich |
| 214 | nicht so gefiltert wie Text in Inhalten, so dass man dort keine Tags verwenden kann.</p> |
| 215 | |
| 216 | <p>Um die Tag-Funktionalität nutzen zu können, müssen Sie bei dem |
| 217 | <a href="' . url('admin/settings/filters') . '">Eingabeformat</a> das Sie nutzen den |
| 218 | "Contaxe-Tags"-Filter aktivieren. Anschließend können Sie die Contaxe-Tags in den |
| 219 | Inhalten an den Stellen verwenden, in denen Banner auftauchen sollen.</p> |
| 220 | |
| 221 | <div class="messages warning">Durch Filter können manchmal Ausgabekonflikte entstehen, |
| 222 | welche sich in manchen Fällen durch umsortieren der Filter beheben lassen.</div> |
| 223 | |
| 224 | <ul> |
| 225 | <li>Banner mit der Id 3 einbinden: |
| 226 | <pre><code>[contaxe:3]</code></pre> |
| 227 | </li> |
| 228 | <li>Banner mit dem Namen <em>Testbanner</em> einbinden: |
| 229 | <pre><code>[contaxe:Testbanner]</code></pre> |
| 230 | </li> |
| 231 | </ul> |
| 232 | |
| 233 | <h3>Contaxe-Injektor</h3> |
| 234 | <p>Der <em>Contaxe-Injektor</em> fügt Werbung automatisch in die Einzel- oder Listenansicht von Inhalten ein. Auf |
| 235 | Wunsch kann das Einfügen auf bestimmte Inhaltstypen beschränkt werden. Für das Einfügen werden |
| 236 | spezielle Templates verwendet, in denen durch <em>Contaxe-Tags</em> Werbung platziert werden kann. |
| 237 | </p> |
| 238 | <div class="messages warning">Einfügen von Werbung in die Mitte eines Inhalts ist leider nicht möglich.</div> |
| 239 | |
| 240 | |
| 241 | <h3>PHP-Code</h3> |
| 242 | <p>Mittels PHP-Code können Banner direkt in ein Template oder einen eigenen Block |
| 243 | mit Eingabeformat <em>PHP-Code</em> eingebunden werden.</p> |
| 244 | <ul> |
| 245 | <li>Banner mit der Id 3 einbinden: |
| 246 | <pre><code>echo contaxe_display(3);</code></pre> |
| 247 | </li> |
| 248 | <li>Banner mit dem Namen <em>Testbanner</em> einbinden: |
| 249 | <pre><code>echo contaxe_display(\'Testbanner\');</code></pre> |
| 250 | </li> |
| 251 | <li>Damit keine Fehler auftreten, falls das Contaxe-Modul aus Versehen deaktiviert |
| 252 | oder gelöscht wird, verwenden Sie am besten die längere Version: |
| 253 | <pre><code>if (module_exists(\'contaxe\')) { |
| 254 | echo contaxe_display(3); |
| 255 | }</code></pre> |
| 256 | </li> |
| 257 | </ul> |
| 258 | <div class="messages warning">Stellen Sie sicher, dass Sie den Code mit PHP-Tags umschließen.</div> |
| 259 | |
| 260 | <h2 id="revenue-sharing">Revenue Sharing</h2> |
| 261 | <h3>Konfiguration</h3> |
| 262 | <p>Um Revenue Sharing nutzen zu können müssen Sie ein Profilfeld anlegen, in welches die |
| 263 | Benutzer ihre Channel-ID eingeben können.</p> |
| 264 | |
| 265 | <ul> |
| 266 | <li>Fügen Sie unter <a href="' . url('admin/user/profile') . '">Verwalten › Benutzerverwaltung › Profile</a> |
| 267 | ein neues <em>Einzeiliges Eingabefeld</em> hinzu. |
| 268 | </li> |
| 269 | <li>Nennen Sie es <em>"Contaxe Channel-ID"</em> oder ähnlich und verwenden Sie als Formularname |
| 270 | <em>profile_contaxe_channel_id</em>. |
| 271 | </li> |
| 272 | <li>Bei Sichtbarkeit stellen Sie <em>Privates Feld, der Inhalt ist nur für privilegierte Benutzer |
| 273 | verfügbar.</em> ein. Alle anderen Einstellungen sind entweder unsicher (andere Benutzer können die |
| 274 | Channel-ID einsehen) oder funktionieren nicht. |
| 275 | </li> |
| 276 | <li>Falls Sie Benutzer dazu zwingen wollen bei der Anmeldung ihre Channel-ID anzugeben, |
| 277 | verwenden Sie zusätzlich die die folgenden Einstellungen: |
| 278 | <ul> |
| 279 | <li>Der Benutzer muss einen Wert eingeben.</li> |
| 280 | <li>Während der Benutzeranmeldung sichtbar.</li> |
| 281 | </ul> |
| 282 | </li> |
| 283 | <li>Ausserdem sollten Sie eine verständliche Erklärung zu dem Feld angeben, |
| 284 | damit die Benutzer wissen, was sie in das Feld eingeben sollen. |
| 285 | </li> |
| 286 | </ul> |
| 287 | <h3>Welche Channel-ID wird beim Einblenden der Werbung benutzt?</h3> |
| 288 | <p>Das System entscheidet bei jedem Seitenaufruf ob</p> |
| 289 | <ul> |
| 290 | <li>die Channel-ID vom Autor des Inhalts,</li> |
| 291 | <li>die Channel-ID vom Benutzer der den Autor geworben hat <em>(falls aktiviert)</em> oder</li> |
| 292 | <li>die Channel-ID der Website genutzt wird.</li> |
| 293 | </ul> |
| 294 | <p>Im letzten Fall wird - falls vorhanden - die Channel-ID des jeweiligen Werbemittels verwendet. Ist dort nichts |
| 295 | angegeben, wird die Channel-ID aus dem Profil des Benutzers 1 verwendet. Ist auch dort nichts eingetragen wird |
| 296 | die Channel-ID aus den <a href="' . url('admin/settings/contaxe') . '">Allgemeinen Einstellungen</a> verwendet. |
| 297 | </p> |
| 298 | <div class="messages warning">Revenue Sharing funktioniert nur auf Seiten mit einzelnen Inhalten sowie auf den Blogs der jeweiligen Autoren (Falls das Blog-Modul genutzt wird).</div> |
| 299 | '; |
| 300 | break; |
| 301 | } |
| 302 | |
| 303 | return $output; |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Valid permissions for this module |
| 308 | * @return array An array of valid permissions for the contaxe module |
| 309 | */ |
| 310 | /* XXX The following is ugly... module adsense uses this to hide ads from admins... |
| 311 | function contaxe_perm() { |
| 312 | return array('Banner verbergen', 'Demo-Banner anzeigen'); |
| 313 | } |
| 314 | */ |
| 315 | |
| 316 | /** |
| 317 | * Menu entries for this module |
| 318 | * @return array An array of menu items |
| 319 | */ |
| 320 | |
| 321 | function contaxe_menu($may_cache) { |
| 322 | $items = array(); |
| 323 | if ($may_cache) { |
| 324 | $items[] = array( |
| 325 | 'path' => 'admin/settings/contaxe', |
| 326 | 'title' => t('Contaxe'), |
| 327 | 'description' => t('Einstellungen für Contaxe-Werbung.'), |
| 328 | 'callback' => 'drupal_get_form', |
| 329 | 'callback arguments' => 'contaxe_admin_general', |
| 330 | 'access' => user_access('administer site configuration'), |
| 331 | 'type' => MENU_NORMAL_ITEM, |
| 332 | ); |
| 333 | $items[] = array( |
| 334 | 'path' => 'admin/settings/contaxe/general', |
| 335 | 'title' => t('Allgemein'), |
| 336 | 'callback' => 'contaxe_admin_general', |
| 337 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 338 | 'weight' => 0, |
| 339 | 'access' => user_access('administer site configuration'), |
| 340 | ); |
| 341 | $items[] = array( |
| 342 | 'path' => 'admin/settings/contaxe/highlighter', |
| 343 | 'title' => t('Text-Highlighting'), |
| 344 | 'callback' => 'drupal_get_form', |
| 345 | 'callback arguments' => array('contaxe_admin_highlighter'), |
| 346 | 'type' => MENU_LOCAL_TASK, |
| 347 | 'weight' => 1, |
| 348 | 'access' => user_access('administer site configuration'), |
| 349 | ); |
| 350 | $items[] = array( |
| 351 | 'path' => 'admin/settings/contaxe/isa', |
| 352 | 'title' => t('Intelligent Search Ad'), |
| 353 | 'callback' => 'drupal_get_form', |
| 354 | 'callback arguments' => array('contaxe_admin_isa'), |
| 355 | 'type' => MENU_LOCAL_TASK, |
| 356 | 'weight' => 2, |
| 357 | 'access' => user_access('administer site configuration'), |
| 358 | ); |
| 359 | $items[] = array( |
| 360 | 'path' => 'admin/settings/contaxe/banners', |
| 361 | 'title' => t('Banner'), |
| 362 | 'callback' => 'contaxe_admin_banners_overview', |
| 363 | 'type' => MENU_LOCAL_TASK, |
| 364 | 'weight' => 3, |
| 365 | 'access' => user_access('administer site configuration'), |
| 366 | ); |
| 367 | $items[] = array( |
| 368 | 'path' => 'admin/settings/contaxe/injector', |
| 369 | 'title' => t('Injektor'), |
| 370 | 'callback' => 'drupal_get_form', |
| 371 | 'callback arguments' => array('contaxe_admin_injector'), |
| 372 | 'type' => MENU_LOCAL_TASK, |
| 373 | 'weight' => 4, |
| 374 | 'access' => user_access('administer site configuration'), |
| 375 | ); |
| 376 | } |
| 377 | else { |
| 378 | if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'contaxe' && arg(3) == 'banners') { |
| 379 | $items[] = array('path' => 'admin/settings/contaxe/banners/list', |
| 380 | 'title' => t('Alle anzeigen'), |
| 381 | 'callback' => 'contaxe_admin_banners_overview', |
| 382 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 383 | 'access' => user_access('administer site configuration'), |
| 384 | ); |
| 385 | $items[] = array('path' => 'admin/settings/contaxe/banners/add', |
| 386 | 'title' => t('Banner hinzufügen'), |
| 387 | 'callback' => 'drupal_get_form', |
| 388 | 'callback arguments' => array('contaxe_admin_banners_form'), |
| 389 | 'type' => MENU_LOCAL_TASK, |
| 390 | 'weight' => 1, |
| 391 | 'access' => user_access('administer site configuration'), |
| 392 | ); |
| 393 | $banners = contaxe_banners(); |
| 394 | if (is_numeric(arg(4)) && isset($banners[arg(4)])) { |
| 395 | $banner = $banners[arg(4)]; |
| 396 | $items[] = array('path' => 'admin/settings/contaxe/banners/'. arg(4), |
| 397 | 'title' => t("Banner !format", array('!format' => $banner['name'])), |
| 398 | 'callback' => 'drupal_get_form', |
| 399 | 'callback arguments' => array('contaxe_admin_banners_form', $banner['id']), |
| 400 | 'type' => MENU_LOCAL_TASK, |
| 401 | 'weight' => 2, |
| 402 | 'access' => user_access('administer site configuration'), |
| 403 | ); |
| 404 | } |
| 405 | if (arg(4) == 'delete') { |
| 406 | $items[] = array('path' => 'admin/settings/contaxe/banners/delete', |
| 407 | 'title' => t('Banner löschen'), |
| 408 | 'callback' => 'drupal_get_form', |
| 409 | 'callback arguments' => array('contaxe_admin_banner_delete'), |
| 410 | 'type' => MENU_CALLBACK, |
| 411 | 'weight' => 3, |
| 412 | 'access' => user_access('administer site configuration'), |
| 413 | ); |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | return $items; |
| 418 | } |
| 419 | |
| 420 | function contaxe_admin_general() { |
| 421 | $form = array(); |
| 422 | $form[CONTAXE_CHANNEL_ID] = array( |
| 423 | '#type' => 'textfield', |
| 424 | '#title' => t('Channel-ID'), |
| 425 | '#default_value' => variable_get(CONTAXE_CHANNEL_ID, ''), |
| 426 | '#size' => 10, |
| 427 | '#maxlength' => 10, |
| 428 | '#description' => t('Channel-ID die standardmäßig bei der Anzeigeneinblendung verwendet wird. Diese kann auf Wunsch für einzelne Werbemittel überschrieben werden. <strong>Achtung:</strong> Geben Sie hier unbedingt die korrekte Channel-ID an, ansonsten wird evtl. keine Werbung eingeblendet bzw. generierte Einnahmen können Ihnen nicht zugeordnet werden.') |
| 429 | ); |
| 430 | if (module_exists('interface_sortable')) { |
| 431 | $form['whoseesads'] = array( |
| 432 | '#type' => 'fieldset', |
| 433 | '#collapsible' => TRUE, |
| 434 | '#collapsed' => TRUE, |
| 435 | '#title' => t('Regelsystem') |
| 436 | ); |
| 437 | $form['whoseesads']['regularvisitor'] = array( |
| 438 | '#type' => 'fieldset', |
| 439 | '#collapsible' => FALSE, |
| 440 | '#collapsed' => FALSE, |
| 441 | '#title' => t('Regelmäßige Besucher'), |
| 442 | '#description' => t('Ein regelmäßiger Besucher ist ein Besucher, der innerhalb von <strong>X</strong> Tagen <strong>Y</strong> Seiten angesehen hat.') |
| 443 | ); |
| 444 | $form['whoseesads']['regularvisitor'][CONTAXE_REGULAR_DAYS] = array( |
| 445 | '#type' => 'textfield', |
| 446 | '#title' => t('Anzahl Tage'), |
| 447 | '#default_value' => variable_get(CONTAXE_REGULAR_DAYS, 3), |
| 448 | '#size' => 10, |
| 449 | '#maxlength' => 10, |
| 450 | ); |
| 451 | $form['whoseesads']['regularvisitor'][CONTAXE_REGULAR_VISITS] = array( |
| 452 | '#type' => 'textfield', |
| 453 | '#title' => t('Seitenaufrufe'), |
| 454 | '#default_value' => variable_get(CONTAXE_REGULAR_VISITS, 10), |
| 455 | '#size' => 10, |
| 456 | '#maxlength' => 10, |
| 457 | ); |
| 458 | } |
| 459 | else { |
| 460 | $form['whoseesads'] = array( |
| 461 | '#type' => 'fieldset', |
| 462 | '#collapsible' => TRUE, |
| 463 | '#collapsed' => TRUE, |
| 464 | '#title' => t('Regelsystem'), |
| 465 | '#description' => '<div class="messages warning">' . t('Benötigt das Modul <a href=!url>JQuery Interface Sortable</a>.', array('!url' => 'http://drupal.org/project/interface_sortable')) . '</div>' |
| 466 | ); |
| 467 | } |
| 468 | $form['visibility'] = array( |
| 469 | '#type' => 'fieldset', |
| 470 | '#collapsible' => TRUE, |
| 471 | '#collapsed' => TRUE, |
| 472 | '#title' => t('Sichtbarkeit') |
| 473 | ); |
| 474 | $form['visibility'][CONTAXE_VISIBILITY_ADMIN] = array( |
| 475 | '#type' => 'select', |
| 476 | '#title' => t('Administratoren sehen'), |
| 477 | '#default_value' => variable_get(CONTAXE_VISIBILITY_ADMIN, CONTAXE_MODE_DEMO), |
| 478 | '#options' => array( |
| 479 | CONTAXE_MODE_NORMAL => t('Echte Werbung'), |
| 480 | CONTAXE_MODE_DEMO => t('Demo-Werbung (Schutz vor Eigenklicks)'), |
| 481 | CONTAXE_MODE_NOTHING => t('Keine Werbung')) |
| 482 | ); |
| 483 | $form['visibility'][CONTAXE_VISIBILITY_USER] = array( |
| 484 | '#type' => 'select', |
| 485 | '#title' => t('Eingeloggte Benutzer sehen'), |
| 486 | '#default_value' => variable_get(CONTAXE_VISIBILITY_USER, CONTAXE_MODE_NORMAL), |
| 487 | '#options' => array( |
| 488 | CONTAXE_MODE_NORMAL => t('Echte Werbung'), |
| 489 | CONTAXE_MODE_DEMO => t('Demo-Werbung'), |
| 490 | CONTAXE_MODE_NOTHING => t('Keine Werbung')) |
| 491 | ); |
| 492 | $form['visibility'][CONTAXE_VISIBILITY_VISITOR] = array( |
| 493 | '#type' => 'select', |
| 494 | '#title' => t('Besucher sehen'), |
| 495 | '#default_value' => variable_get(CONTAXE_VISIBILITY_VISITOR, CONTAXE_MODE_NORMAL), |
| 496 | '#options' => array( |
| 497 | CONTAXE_MODE_NORMAL => t('Echte Werbung'), |
| 498 | CONTAXE_MODE_DEMO => t('Demo-Werbung'), |
| 499 | CONTAXE_MODE_NOTHING => t('Keine Werbung')) |
| 500 | ); |
| 501 | if (module_exists('profile')) { |
| 502 | // Revenue sharing is possible |
| 503 | $form['revenue_sharing'] = array( |
| 504 | '#type' => 'fieldset', |
| 505 | '#collapsible' => TRUE, |
| 506 | '#collapsed' => TRUE, |
| 507 | '#title' => t('Revenue Sharing') |
| 508 | ); |
| 509 | $warnings = ''; |
| 510 | if (variable_get('cache', 0)) { |
| 511 | $warnings .= '<li>' . t('Der Seitencache ist aktiviert. Dies führt zu Konflikten mit dem Revenue Sharing, da die Seiten nicht immer dynamisch generiert werden. Falls Probleme mit dem Revenue Sharing auftreten, deaktivieren Sie den Cache bitte.') . '</li>'; |
| 512 | } |
| 513 | if (($field = variable_get(CONTAXE_REVENUE_PROFILE_FIELD, 0)) == 0 || ($fields = contaxe_get_profile_fields()) == NULL || !isset($fields[$field])) { |
| 514 | $warnings .= '<li>' . t('Es ist kein Profil-Feld ausgewählt. Bitte legen Sie eines gemäß der Beschreibung in der Hilfe an und wählen Sie es hier aus.') . '</li>'; |
| 515 | } |
| 516 | if (!empty($warnings)) { |
| 517 | $form['revenue_sharing']['revenue_warnings'] = array( |
| 518 | '#type' => 'markup', |
| 519 | '#value' => '<div class="messages warning"><ul>' . $warnings . '</ul></div>' |
| 520 | ); |
| 521 | } |
| 522 | $form['revenue_sharing'][CONTAXE_REVENUE_ENABLE] = array( |
| 523 | '#type' => 'checkbox', |
| 524 | '#title' => t('Aktiviere Revenue Sharing'), |
| 525 | '#return_value' => 1, |
| 526 | '#default_value' => variable_get(CONTAXE_REVENUE_ENABLE, 0), |
| 527 | ); |
| 528 | $form['revenue_sharing'][CONTAXE_REVENUE_PROFILE_FIELD] = array( |
| 529 | '#type' => 'select', |
| 530 | '#title' => t('Profil-Feld mit Contaxe Channel-ID'), |
| 531 | '#default_value' => variable_get(CONTAXE_REVENUE_PROFILE_FIELD, 0), |
| 532 | '#options' => contaxe_get_profile_fields(), |
| 533 | '#required' => TRUE, |
| 534 | '#description' => t('Wählen Sie hier das Profil-Feld, welches die Contaxe Channel-ID der Benutzer enthält, die am Revenue Sharing teilnehmen. Sie müssen dazu wie in der <a href="!url#revenue-sharing">Hilfe beschrieben</a> ein neues Feld anlegen.', array('!url' => url('admin/help/contaxe'))), |
| 535 | ); |
| 536 | |
| 537 | $list = drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 100)); |
| 538 | $form['revenue_sharing'][CONTAXE_PERCENTAGE_AUTHOR] = array( |
| 539 | '#type' => 'select', |
| 540 | '#title' => t('Prozentsatz der Inhaltsansichten die an den Autor gehen'), |
| 541 | '#default_value' => variable_get(CONTAXE_PERCENTAGE_AUTHOR, 0), |
| 542 | '#options' => $list |
| 543 | ); |
| 544 | if (module_exists('referral')) { |
| 545 | $form['revenue_sharing'][CONTAXE_PERCENTAGE_REFERRAL] = array( |
| 546 | '#type' => 'select', |
| 547 | '#title' => t('Prozentsatz der Inhaltsansichten die an den Benutzer gehen, der den Autor geworben hat'), |
| 548 | '#default_value' => variable_get(CONTAXE_PERCENTAGE_REFERRAL, 0), |
| 549 | '#options' => $list |
| 550 | ); |
| 551 | } |
| 552 | else { |
| 553 | $form['revenue_sharing'][CONTAXE_PERCENTAGE_REFERRAL] = array( |
| 554 | '#type' => 'select', |
| 555 | '#title' => t('Prozentsatz der Inhaltsansichten die an den Benutzer gehen, der den Autor geworben hat'), |
| 556 | '#default_value' => variable_get(CONTAXE_PERCENTAGE_REFERRAL, 0), |
| 557 | '#options' => array('-'), |
| 558 | '#disabled' => TRUE, |
| 559 | '#description' => '<div class="messages warning">' . t('Benötigt das <a href=!url>Referral-Modul</a>.', array('!url' => 'http://drupal.org/project/referral')) . '</div>' |
| 560 | ); |
| 561 | } |
| 562 | } |
| 563 | else { |
| 564 | $form['revenue_sharing'] = array( |
| 565 | '#type' => 'fieldset', |
| 566 | '#collapsible' => TRUE, |
| 567 | '#collapsed' => TRUE, |
| 568 | '#title' => t('Revenue Sharing'), |
| 569 | '#description' => '<div class="messages warning">' . t('Benötigt das <a href=!url>Profile-Modul</a>.', array('!url' => url('admin/build/modules'))) . '</div>' |
| 570 | ); |
| 571 | } |
| 572 | return system_settings_form($form); |
| 573 | } |
| 574 | |
| 575 | function contaxe_get_profile_fields() { |
| 576 | static $profile_list = NULL; |
| 577 | if (isset($profile_list)) return $profile_list; |
| 578 | $profile_list = array(0 => 'Keines'); |
| 579 | |
| 580 | $result = db_query('SELECT fid, title FROM {profile_fields} ORDER BY fid'); |
| 581 | while ($row = db_fetch_object($result)) { |
| 582 | $profile_list[$row->fid] = $row->title; |
| 583 | } |
| 584 | |
| 585 | return $profile_list; |
| 586 | } |
| 587 | |
| 588 | function contaxe_admin_highlighter() { |
| 589 | $contaxe_css = drupal_get_path('module', 'contaxe') .'/contaxe.css'; |
| 590 | drupal_add_css($contaxe_css, 'module', 'all', FALSE); |
| 591 | |
| 592 | $form = array(); |
| 593 | $form[CONTAXE_HIGHLIGHTER_ENABLE] = array( |
| 594 | '#type' => 'checkbox', |
| 595 | '#title' => t('Aktiviere Text-Highlighting'), |
| 596 | '#return_value' => 1, |
| 597 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_ENABLE, 0), |
| 598 | ); |
| 599 | |
| 600 | $form[CONTAXE_HIGHLIGHTER_CHANNEL_ID] = array( |
| 601 | '#type' => 'textfield', |
| 602 | '#title' => t('Channel-ID'), |
| 603 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_CHANNEL_ID, ''), |
| 604 | '#size' => 10, |
| 605 | '#maxlength' => 10, |
| 606 | '#description' => t('Channel-ID die bei der Einblendung des Highlighters verwendet wird. Wenn Sie dieses Feld leer lassen wird die Channel-ID aus den Allgemeinen Einstellungen verwendet. <strong>Achtung:</strong> Geben Sie hier unbedingt die korrekte Channel-ID an, ansonsten wird evtl. keine Werbung eingeblendet bzw. generierte Einnahmen können Ihnen nicht zugeordnet werden.') |
| 607 | ); |
| 608 | $form['advanced'] = array( |
| 609 | '#type' => 'fieldset', |
| 610 | '#collapsible' => TRUE, |
| 611 | '#collapsed' => TRUE, |
| 612 | '#title' => t('Erweiterte Einstellungen') |
| 613 | ); |
| 614 | $form['advanced'][CONTAXE_HIGHLIGHTER_DESIGN_ID] = array( |
| 615 | '#type' => 'textfield', |
| 616 | '#title' => t('Design-ID'), |
| 617 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_DESIGN_ID, ''), |
| 618 | '#size' => 10, |
| 619 | '#maxlength' => 10, |
| 620 | '#description' => t('Falls Sie ein eigenes Design für den Highlighter wünschen, erstellen Sie dieses bitte bei Contaxe und tragen Sie die ID hier ein. Leer lassen für Standard-Design.') |
| 621 | ); |
| 622 | $form['advanced'][CONTAXE_HIGHLIGHTER_BIGFONT] = array( |
| 623 | '#type' => 'checkbox', |
| 624 | '#title' => t('Größere Schrift verwenden'), |
| 625 | '#return_value' => 1, |
| 626 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_BIGFONT, 0), |
| 627 | ); |
| 628 | $form['advanced'][CONTAXE_HIGHLIGHTER_WORDS] = array( |
| 629 | '#type' => 'textfield', |
| 630 | '#title' => t('Anzahl Wörter'), |
| 631 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_WORDS, '5'), |
| 632 | '#size' => 10, |
| 633 | '#maxlength' => 10, |
| 634 | '#description' => t('Maximale Anzahl unterschiedlicher Wörter, die vom Highlighter verlinkt werden dürfen.') |
| 635 | ); |
| 636 | $form['advanced'][CONTAXE_HIGHLIGHTER_REPEAT] = array( |
| 637 | '#type' => 'textfield', |
| 638 | '#title' => t('Wortwiederholungen'), |
| 639 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_REPEAT, '5'), |
| 640 | '#size' => 10, |
| 641 | '#maxlength' => 10, |
| 642 | '#description' => t('Max. Anzahl, wie oft ein einzelnes Wort für ein Highlight verwendet werden darf.') |
| 643 | ); |
| 644 | $form['advanced'][CONTAXE_HIGHLIGHTER_DELAY] = array( |
| 645 | '#type' => 'textfield', |
| 646 | '#title' => t('Popup-Schließverzögerung'), |
| 647 | '#default_value' => variable_get(CONTAXE_HIGHLIGHTER_DELAY, '2000'), |
| 648 | '#size' => 10, |
| 649 | '#maxlength' => 10, |
| 650 | '#description' => t('Zeit in Millisekunden. Legt fest wie lange das Highlighter-Popup geöffnet bleiben soll, nachdem der Besucher mit der Maus das Popup bzw. den Link verlassen hat.<br/><strong>Minimum:</strong> 400 (0,4 Sekunden)<br/> |
| 651 | <strong>Maximum:</strong> 5000 (5 Sekunden)') |
| 652 | ); |
| 653 | if (module_exists('interface_sortable')) { |
| 654 | $activeid = CONTAXE_HIGHLIGHTER_ACTIVE_RULES; |
| 655 | $inactiveid = CONTAXE_HIGHLIGHTER_INACTIVE_RULES; |
| 656 | $onchange = <<<EOT |
| 657 | function (obj) { |
| 658 | serial1 = $.SortSerialize('$activeid-wrapper'); |
| 659 | serial2 = $.SortSerialize('$inactiveid-wrapper'); |
| 660 | document.getElementById('edit-$activeid').value = serial1.hash; |
| 661 | document.getElementById('edit-$inactiveid').value = serial2.hash; |
| 662 | } |
| 663 | EOT; |
| 664 | $form['whoseesads'] = array( |
| 665 | '#type' => 'fieldset', |
| 666 | '#collapsible' => TRUE, |
| 667 | '#collapsed' => TRUE, |
| 668 | '#title' => t('Regelsystem') |
| 669 | ); |
| 670 | $form['whoseesads']['active'] = array( |
| 671 | '#type' => 'fieldset', |
| 672 | '#collapsible' => FALSE, |
| 673 | '#title' => t('Aktive Regeln'), |
| 674 | '#description' => t('Regeln die die Sichtbarkeit des Highlighters steuern. Verfügbare Regeln hierher ziehen und ordnen. Wenn keine der Regeln zutrifft wird der Highlighter nicht eingeblendet. <em>Wenn keine Regeln gewählt werden, wird der Highlighter immer eingeblendet.</em>') |
| 675 | ); |
| 676 | $form['whoseesads']['active'][CONTAXE_HIGHLIGHTER_ACTIVE_RULES] = array( |
| 677 | '#type' => 'sortable', |
| 678 | '#items' => contaxe_sortable(true, variable_get('contaxe_highlighter_active', array())), |
| 679 | '#inner_id' => 'rules', |
| 680 | '#options' => array( |
| 681 | 'helperclass' => 'sortable-helper', |
| 682 | 'handle' => 'span.contaxe-handle', |
| 683 | '#onchange' => $onchange |
| 684 | ) |
| 685 | ); |
| 686 | $form['whoseesads']['inactive'] = array( |
| 687 | '#type' => 'fieldset', |
| 688 | '#collapsible' => FALSE, |
| 689 | '#title' => t('Verfügbare Regeln'), |
| 690 | '#description' => t('Alle verfügbaren Regeln um die Sichtbarkeit des Highlighters zu steuern.') |
| 691 | ); |
| 692 | $form['whoseesads']['inactive'][CONTAXE_HIGHLIGHTER_INACTIVE_RULES] = array( |
| 693 | '#type' => 'sortable', |
| 694 | '#items' => contaxe_sortable(false, variable_get('contaxe_highlighter_active', array())), |
| 695 | '#inner_id' => 'rules', |
| 696 | '#options' => array( |
| 697 | 'helperclass' => 'sortable-helper', |
| 698 | 'handle' => 'span.contaxe-handle', |
| 699 | '#onchange' => $onchange |
| 700 | ) |
| 701 | ); |
| 702 | } |
| 703 | else { |
| 704 | $form['whoseesads'] = array( |
| 705 | '#type' => 'fieldset', |
| 706 | '#collapsible' => TRUE, |
| 707 | '#collapsed' => TRUE, |
| 708 | '#title' => t('Regelsystem'), |
| 709 | '#description' => '<div class="messages warning">' . t('Benötigt das Modul <a href=!url>JQuery Interface Sortable</a>.', array('!url' => 'http://drupal.org/project/interface_sortable')) . '</div>' |
| 710 | ); |
| 711 | } |
| 712 | return system_settings_form($form); |
| 713 | } |
| 714 | |
| 715 | function contaxe_admin_highlighter_submit($form_id, $form_values) { |
| 716 | $active = contaxe_sortable_submit(interface_get_sort($_POST[CONTAXE_HIGHLIGHTER_ACTIVE_RULES ], 'rules')); |
| 717 | $form_values['contaxe_highlighter_active'] = $active; |
| 718 | /* TODO maybe we should save order and values of inactive rules... |
| 719 | $inactive = contaxe_sortable_submit(interface_get_sort($_POST[CONTAXE_HIGHLIGHTER_INACTIVE_RULES], 'rules')); |
| 720 | $form_values['contaxe_highlighter_inactive'] = $inactive; |
| 721 | */ |
| 722 | $form_values = contaxe_clean_form_values($form_values, 'contaxe_highlighter'); |
| 723 | system_settings_form_submit($form_id, $form_values); |
| 724 | } |
| 725 | |
| 726 | function contaxe_admin_isa() { |
| 727 | $contaxe_css = drupal_get_path('module', 'contaxe') .'/contaxe.css'; |
| 728 | drupal_add_css($contaxe_css, 'module', 'all', FALSE); |
| 729 | |
| 730 | $form = array(); |
| 731 | |
| 732 | if (module_exists('search')) { |
| 733 | $form[CONTAXE_ISA_ENABLE] = array( |
| 734 | '#type' => 'checkbox', |
| 735 | '#title' => t('Aktiviere Intelligent Search Ad'), |
| 736 | '#return_value' => 1, |
| 737 | '#default_value' => variable_get(CONTAXE_ISA_ENABLE, 0), |
| 738 | ); |
| 739 | |
| 740 | $form[CONTAXE_ISA_CHANNEL_ID] = array( |
| 741 | '#type' => 'textfield', |
| 742 | '#title' => t('Channel-ID'), |
| 743 | '#default_value' => variable_get(CONTAXE_ISA_CHANNEL_ID, ''), |
| 744 | '#size' => 10, |
| 745 | '#maxlength' => 10, |
| 746 | '#description' => t('Channel-ID die bei der Einblendung des Intelligent Search Ads verwendet wird. Wenn Sie dieses Feld leer lassen wird die ID aus den Allgemeinen Einstellungen verwendet. <strong>Achtung:</strong> Geben Sie hier unbedingt die korrekte Channel-ID an, ansonsten wird evtl. keine Werbung eingeblendet bzw. generierte Einnahmen können Ihnen nicht zugeordnet werden.') |
| 747 | ); |
| 748 | $form[CONTAXE_ISA_DESIGN_ID] = array( |
| 749 | '#type' => 'textfield', |
| 750 | '#title' => t('Design-ID'), |
| 751 | '#default_value' => variable_get(CONTAXE_ISA_DESIGN_ID, ''), |
| 752 | '#size' => 10, |
| 753 | '#maxlength' => 10, |
| 754 | '#description' => t('Falls Sie ein eigenes Design für das Intelligent Search Ad wünschen, erstellen Sie dieses bitte bei Contaxe und tragen Sie die ID hier ein. Leer lassen für Standard-Design.') |
| 755 | ); |
| 756 | $list = array( |
| 757 | 55 => t('1 Anzeige'), |
| 758 | 56 => t('2 Anzeigen'), |
| 759 | 57 => t('5 Titel'), |
| 760 | 58 => t('10 Titel') |
| 761 | ); |
| 762 | $form[CONTAXE_ISA_TYPE] = array( |
| 763 | '#type' => 'select', |
| 764 | '#title' => t('Format'), |
| 765 | '#default_value' => variable_get(CONTAXE_ISA_TYPE, 57), |
| 766 | '#options' => $list |
| 767 | ); |
| 768 | } |
| 769 | else { |
| 770 | $form['no_search_module'] = array( |
| 771 | '#type' => 'markup', |
| 772 | '#weight' => -1, |
| 773 | '#value' => '<div class="messages warning">' . t('Für das <em>Intelligent Search Ad</em> muss das Modul <em>Search</em> aktiviert sein.') . '</div>' |
| 774 | ); |
| 775 | return $form; |
| 776 | } |
| 777 | return system_settings_form($form); |
| 778 | } |
| 779 | |
| 780 | function contaxe_admin_isa_submit($form_id, $form_values) { |
| 781 | $form_values = contaxe_clean_form_values($form_values, 'contaxe_isa'); |
| 782 | system_settings_form_submit($form_id, $form_values); |
| 783 | } |
| 784 | |
| 785 | function contaxe_admin_injector() { |
| 786 | $form = array(); |
| 787 | $form['node_body_insertion'] = array( |
| 788 | '#type' => 'fieldset', |
| 789 | '#collapsible' => TRUE, |
| 790 | '#collapsed' => FALSE, |
| 791 | '#title' => t('Injektion in Einzelansicht'), |
| 792 | ); |
| 793 | $form['node_body_insertion']['contaxe_injector_body_enable'] = array( |
| 794 | '#type' => 'checkbox', |
| 795 | '#title' => t('Werbung in Einzelansicht einfügen'), |
| 796 | '#return_value' => 1, |
| 797 | '#default_value' => variable_get('contaxe_injector_body_enable', 0), |
| 798 | ); |
| 799 | $form['node_body_insertion']['contaxe_injector_minwords'] = array( |
| 800 | '#type' => 'textfield', |
| 801 | '#title'=> t('Mindestanzahl an Wörtern pro Inhalt'), |
| 802 | '#size' => 5, |
| 803 | '#default_value' => variable_get('contaxe_injector_minwords', 75), |
| 804 | '#description' => t('Werbung wird nur eingefügt, wenn ein Inhalt mindestens soviele Wörter hat.') |
| 805 | ); |
| 806 | $form['node_body_insertion']['contaxe_injector_body_template'] = array( |
| 807 | '#type' => 'textarea', |
| 808 | '#title'=> t('Template für die Einzelansicht'), |
| 809 | '#rows' => 6, |
| 810 | '#cols' => 40, |
| 811 | '#default_value' => variable_get('contaxe_injector_body_template', CONTAXE_INJECTOR_DEFAULT_BODY_TEMPLATE), |
| 812 | '#description' => t('%body wird durch den kompletten Text des Inhalts ersetzt. Fügen Sie hier <a href="!url#contaxe-tags">Contaxe-Tags</a> ein.', array('!url' => url('admin/help/contaxe'))), |
| 813 | '#required' => TRUE |
| 814 | ); |
| 815 | |
| 816 | $form['node_list_insertion'] = array( |
| 817 | '#type' => 'fieldset', |
| 818 | '#collapsible' => TRUE, |
| 819 | '#collapsed' => FALSE, |
| 820 | '#title' => t('Injektion in Listenansicht'), |
| 821 | ); |
| 822 | $form['node_list_insertion']['contaxe_injector_list_enable'] = array( |
| 823 | '#type' => 'checkbox', |
| 824 | '#title' => t('Werbung in Listenansicht einfügen'), |
| 825 | '#return_value' => 1, |
| 826 | '#default_value' => variable_get('contaxe_injector_list_enable', 0), |
| 827 | ); |
| 828 | $form['node_list_insertion']['contaxe_injector_list_template'] = array( |
| 829 | '#type' => 'textarea', |
| 830 | '#title'=> t('Template für die Listenansicht'), |
| 831 | '#rows' => 6, |
| 832 | '#cols' => 40, |
| 833 | '#default_value' => variable_get('contaxe_injector_list_template', CONTAXE_INJECTOR_DEFAULT_LIST_TEMPLATE), |
| 834 | '#description' => t('%teaser wird durch den Anrisstext des Inhalts ersetzt. Fügen Sie hier <a href="!url#contaxe-tags">Contaxe-Tags</a> ein.', array('!url' => url('admin/help/contaxe'))), |
| 835 | '#required' => TRUE |
| 836 | ); |
| 837 | |
| 838 | $form['injection_control'] = array( |
| 839 | '#type' => 'fieldset', |
| 840 | '#collapsible' => TRUE, |
| 841 | '#collapsed' => TRUE, |
| 842 | '#title' => t('Wählen Sie Inhaltstypen für das Einfügen'), |
| 843 | '#description' => t('Banner werden <strong>nur</strong> bei den gewählten Inhaltstypen eingefügt.'), |
| 844 | ); |
| 845 | |
| 846 | $enabled_count = 0; |
| 847 | foreach (node_get_types() as $type => $obj) { |
| 848 | $enabled = variable_get(CONTAXE_INJECTOR_NODETYPE . $type, FALSE); |
| 849 | if ($enabled) $enabled_count++; |
| 850 | $form['injection_control']['node_types'][CONTAXE_INJECTOR_NODETYPE . $type] = array( |
| 851 | '#type' => 'checkbox', |
| 852 | '#title'=> $obj->name, |
| 853 | '#default_value' => $enabled, |
| 854 | '#description' => t('Werbung beim Inhaltstyp %nodetype einfügen.', array('%nodetype' => $obj->name)), |
| 855 | '#required' => FALSE |
| 856 | ); |
| 857 | } |
| 858 | |
| 859 | if ($enabled_count == 0) { |
| 860 | $msg = t('Da keine Inhaltstypen ausgewählt sind wird durch den Contaxe-Injektor derzeit nirgends Werbung eingefügt.'); |
| 861 | $form['injection_control']['#collapsed'] = FALSE; |
| 862 | $form['injection_control']['no_nodes_enabled'] = array( |
| 863 | '#type' => 'markup', |
| 864 | '#weight' => -1, |
| 865 | '#value' => '<div class="messages error">' . $msg . '</div>' |
| 866 | ); |
| 867 | } |
| 868 | |
| 869 | return system_settings_form($form); |
| 870 | } |
| 871 | |
| 872 | function contaxe_clean_form_values($form_values, $valid_prefix) { |
| 873 | $vars = array_keys($form_values); |
| 874 | foreach ($vars as $var) { |
| 875 | if ($var == 'op') continue; |
| 876 | if (strpos($var, $valid_prefix) === 0) continue; |
| 877 | unset($form_values[$var]); |
| 878 | } |
| 879 | return $form_values; |
| 880 | } |
| 881 | |
| 882 | /** |
| 883 | * Displays a list of all banners |
| 884 | */ |
| 885 | function contaxe_admin_banners_overview() { |
| 886 | $banners = contaxe_banners(); |
| 887 | $rows = array(); |
| 888 | foreach ($banners as $id => $banner) { |
| 889 | $rows[] = array( |
| 890 | check_plain($banner['id']), |
| 891 | check_plain($banner['name']), |
| 892 | check_plain($GLOBALS['_CONTAXE_ADFORMATS'][$banner['format']]['title']), |
| 893 | check_plain($banner['channel']), |
| 894 | $banner['enabled'] ? 'x' : '-', |
| 895 | l(t('view'), 'admin/settings/contaxe/banners/'. $id), |
| 896 | l(t('delete'), 'admin/settings/contaxe/banners/delete/'. $id) |
| 897 | ); |
| 898 | unset($form[$id]); |
| 899 | } |
| 900 | $header = array(t('Id'), t('Name'), t('Format'), t('Channel'), t('Enabled'), array('data' => t('Operations'), 'colspan' => 2)); |
| 901 | $output = theme('table', $header, $rows); |
| 902 | $output .= drupal_render($form); |
| 903 | |
| 904 | return $output; |
| 905 | } |
| 906 | /** |
| 907 | * Menu callback; confirm deletion of a banner. |
| 908 | */ |
| 909 | function contaxe_admin_banner_delete() { |
| 910 | $id = arg(5); |
| 911 | $banner = contaxe_banner($id); |
| 912 | |
| 913 | if (isset($banner)) { |
| 914 | $form['id'] = array('#type' => 'hidden', '#value' => $banner['id']); |
| 915 | $form['name'] = array('#type' => 'hidden', '#value' => $banner['name']); |
| 916 | |
| 917 | return confirm_form($form, t('Sind sie sicher, dass Sie den Banner %name löschen wollen?', array('%name' => $banner['name'])), 'admin/settings/contaxe/banners', t(''), t('Delete'), t('Cancel')); |
| 918 | } |
| 919 | else { |
| 920 | return drupal_not_found(); // see http://drupal.org/node/93587 |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | /** |
| 925 | * Process contaxe banner delete form submission. |
| 926 | */ |
| 927 | function contaxe_admin_banner_delete_submit($form_id, $form_values) { |
| 928 | $banners = contaxe_banners(); |
| 929 | unset($banners[$form_values['id']]); |
| 930 | // contaxe_save_banners($banners); |
| 931 | drupal_set_message(t('Banner %name gelöscht.', array('%name' => $form_values['name']))); |
| 932 | return 'admin/settings/contaxe/banners'; |
| 933 | } |
| 934 | |
| 935 | function contaxe_admin_banners_form($id = NULL) { |
| 936 | $contaxe_css = drupal_get_path('module', 'contaxe') .'/contaxe.css'; |
| 937 | drupal_add_css($contaxe_css, 'module', 'all', FALSE); |
| 938 | |
| 939 | $banner = contaxe_banner($id); |
| 940 | $form = array(); |
| 941 | $form['name'] = array( |
| 942 | '#type' => 'textfield', |
| 943 | '#title' => t('Name'), |
| 944 | '#default_value' => $banner['name'], |
| 945 | '#size' => 50, |
| 946 | '#description' => t('Frei wählbarer Name.') |
| 947 | ); |
| 948 | $form['format'] = array( |
| 949 | '#type' => 'select', |
| 950 | '#title' => t('Format'), |
| 951 | '#default_value' => $banner['format'], |
| 952 | '#options' => array_map(create_function('$n', 'return $n[\'title\'];'), $GLOBALS['_CONTAXE_ADFORMATS']) |
| 953 | ); |
| 954 | $form['enabled'] = array( |
| 955 | '#type' => 'checkbox', |
| 956 | '#title' => t('Aktiv'), |
| 957 | '#return_value' => 1, |
| 958 | '#default_value' => isset($banner) ? $banner['enabled'] : TRUE |
| 959 | ); |
| 960 | |
| 961 | $form['advanced'] = array( |
| 962 | '#type' => 'fieldset', |
| 963 | '#collapsible' => TRUE, |
| 964 | '#collapsed' => TRUE, |
| 965 | '#title' => t('Erweiterte Einstellungen') |
| 966 | ); |
| 967 | $form['advanced']['channel'] = array( |
| 968 | '#type' => 'textfield', |
| 969 | '#title' => t('Channel-ID'), |
| 970 | '#default_value' => $banner['channel'], |
| 971 | '#size' => 10, |
| 972 | '#maxlength' => 10, |
| 973 | '#description' => t('Channel-ID die bei der Einblendung des Banners verwendet wird. Wenn Sie dieses Feld leer lassen wird die ID aus den Allgemeinen Einstellungen verwendet. <strong>Achtung:</strong> Geben Sie hier unbedingt die korrekte Channel-ID an, ansonsten wird evtl. keine Werbung eingeblendet bzw. generierte Einnahmen können Ihnen nicht zugeordnet werden.') |
| 974 | ); |
| 975 | $form['advanced']['opt'] = array( |
| 976 | '#type' => 'select', |
| 977 | '#title' => t('Optimierung'), |
| 978 | '#default_value' => $banner['opt'], |
| 979 | '#options' => $GLOBALS['_CONTAXE_BANNER_OPTIMIZATION'] |
| 980 | ); |
| 981 | $form['advanced']['rnd'] = array( |
| 982 | '#type' => 'checkbox', |
| 983 | '#title' => t('Bannerplatz mit zufälliger Werbung auffüllen falls keine passende Werbung gefunden wurde.'), |
| 984 | '#return_value' => 1, |
| 985 | '#default_value' => isset($banner) ? $banner['rnd'] : TRUE |
| 986 | ); |
| 987 | $form['advanced']['style'] = array( |
| 988 | '#type' => 'textfield', |
| 989 | '#title' => t('Design-ID'), |
| 990 | '#default_value' => $banner['style'], |
| 991 | '#size' => 10, |
| 992 | '#maxlength' => 10, |
| 993 | '#description' => t('Nur bei Textbannern: Falls Sie ein eigenes Design für den Banner wünschen, erstellen Sie dieses bitte bei Contaxe und tragen Sie die ID hier ein. Leer lassen für Standard-Design.') |
| 994 | ); |
| 995 | $form['advanced']['params'] = array( |
| 996 | '#type' => 'textfield', |
| 997 | '#title' => t('Erweiterte Parameter'), |
| 998 | '#default_value' => $banner['params'], |
| 999 | '#size' => 50, |